Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

autocomplete

Tells the browser and password managers what a field holds, so saved names, addresses, cards, passwords and one-time codes can be filled in one step.

Overview

autocomplete names the kind of data a field expects, using autofill tokens such as email, shipping postal-code or current-password. With the right tokens, browsers and password managers fill a whole address or sign-in form in one step, which matters most on phones. On a <form>, on or off sets the default for controls that don't say otherwise.

Applies to: <input>, <select>, <textarea> (tokens, or on/off) and <form> (on/off only).

Values

A value is either on, off, or an ordered list of tokens: optional modifiers, then one field name, then optionally webauthn.

ValueMeaning
onAutofill allowed; the browser guesses the field type.
offDon't offer saved data for this field. Browsers generally honour it for ordinary fields; password managers may still offer credentials on login fields.
A field name (tables below)This field holds that piece of data.
AbsentThe control uses its form's autocomplete; a form without one counts as on.
Anything elseInvalid; treated as if no token was given. Made-up values are non-conforming and their effect varies by browser.

Modifiers

TokenPurpose
section-nameGroups fields so two addresses on one page (sender and recipient) fill separately. Comes first.
shipping / billingWhich address or contact the field belongs to.
home, work, mobile, fax, pagerKind of contact, before tel, email and the other contact fields: work email, mobile tel.
webauthnLast token on a username or password field. Lets the browser offer saved passkeys in the field's autofill list (passkey "conditional UI").

Common field names

GroupTokens
Namename, given-name, additional-name, family-name, honorific-prefix, nickname
Contactemail, tel, tel-national, tel-country-code, impp
Addressstreet-address (multi-line, use a textarea), address-line1–3, address-level2 (city), address-level1 (state or province), postal-code, country (code), country-name
Organisationorganization, organization-title
Paymentcc-name, cc-number, cc-exp, cc-exp-month, cc-exp-year, cc-csc, cc-type
Accountsusername, current-password, new-password, one-time-code
Otherbday, bday-day, bday-month, bday-year, sex, language, url, photo

Examples

Sign in, with passkeys

webauthn only shows passkeys when the page has also started a conditional request: navigator.credentials.get({ mediation: 'conditional', publicKey: ... }).

New password

new-password tells password managers to suggest a generated password and save it, instead of filling the old one.

One-time codes

one-time-code lets the phone offer a code from an SMS or email above the keyboard. In VB, an OTP field adds it for you (see below).

Two addresses on one page

In Vanilla Breeze

  • Drafts never store secrets. data-autosave and data-wizard-persist skip any control whose own autocomplete is off or contains cc-number, cc-csc, cc-exp, cc-exp-month, cc-exp-year, one-time-code, new-password or current-password, as well as password, hidden and file inputs (src/utils/_persist-filter.js). Correct tokens on payment fields keep card data out of localStorage. The filter reads each control's attribute, not the form's, so <form autocomplete="off"> alone does not exclude its fields.
  • OTP fields. <form-field> with input[data-type="otp"] splits the input into digit boxes and moves autocomplete="one-time-code" (or the value you set) to the first box, which accepts a whole pasted or autofilled code. The digits use inputmode="numeric". data-type="pin" uses off instead (src/lib/form-field-enhancements.js).
  • Keyboards. data-mask and data-accept add a matching inputmode; they don't touch autocomplete.

Accessibility

  • WCAG 1.3.5 (Identify Input Purpose, AA) asks that fields collecting information about the user carry the matching autofill token. Correct tokens also let assistive tools add icons or familiar labels.
  • Autofill saves typing for people with motor or cognitive disabilities. Don't turn it off without a reason.
  • Keep visible labels; autofill is not a substitute for knowing what a field is.

Security

  • autocomplete="off" is not a security control. Users can still paste, and password managers may ignore it on credential fields. Use it for fields where a remembered value is wrong (a one-time search box, a field for someone else's details), not to "protect" passwords.
  • Use new-password on sign-up and change-password forms so password managers generate strong, unique passwords.

Gotchas

  • Made-up values such as autocomplete="nope" are invalid HTML and behave differently from browser to browser. To stop autofill on a field, use off; to stop a password manager filling the wrong password, use the right token (new-password).
  • Autofill fills by token, not by name or id. A field whose label says "City" but whose token says postal-code gets the postal code.
  • street-address is multi-line; use it on a <textarea>, or split into address-line1 and address-line2 inputs.
  • Autofill fires input and change events, but some browsers fill several fields at once before focus moves. Validate on submit as well as on blur.

Related

Which to choose

  • A field-name token — every field that asks for the user's own data.
  • off — fields where a remembered value is wrong or someone else's data is entered.
  • list — suggestions you supply, not the user's saved data.
↑