Building Forms
Mobile Users
Will Love

Accessibility

We’re all just temporarily abled.
Cindy Li

Complexity

desktop tablet phone console watch smart fridge mouse keyboard trackpad stylus assistive tech low vision tremors/transit injury distraction

Use semantic markup.

  • Worry less about ARIA.
  • Write less JavaScript.
  • Future-proof your apps.

Foundation

<label>
  Username
  <input type="text" />
</label>

Foundation

<label for="username">Username</label>
<input id="username" type="text" />

Foundation

<label for="username">Username</label>
<input id="username" type="text"
  aria-describedby="username-hint" />
<p id="username-hint">Username must be
at least 8 characters long and cannot
contain special characters.</p>

Attributes

type

Semantically identifies the type of content the input accepts.

Occasionally suggests more specific labels for screen readers.

input with type password

input[type="password"]
A11Y API Mappings (AAM)

autocomplete

Tells browsers what user data to offer as autocomplete options.

Mapped to accessibility state.

MDN

autocomplete

autocomplete
A11Y API Mappings (AAM)

inputmode

Suggests the ideal on-screen keyboard for mobile devices.

No accessibility mappings.

MDN

Use Cases

Username

<input
  type="text"
  autocomplete="username"
  autocapitalize="none"
  autocorrect="off"
  spellcheck="false"
/>

Android keyboard: username

iOS keyboard: username

Email Address

<input
  type="email"
  autocomplete="email"
/>

Android keyboard: email

iOS keyboard: email

Telephone Number

<input
  type="tel"
  autocomplete="tel"
/>

Android keyboard: telephone

iOS keyboard: telephone

Address

<input
  type="text"
  autocomplete=
    "street-address"
/>

Android keyboard: address

iOS keyboard: address

Number

<input
  type="number"
/>

“inappropriate for credit card numbers or US postal codes”
(HTML Spec)

Number

<input
  type="text"
  inputmode="decimal"
/>

Android keyboard: number

iOS keyboard: number

GOV.UK Number Inputs

Supercharged Number Inputs

Verification Code

<input
  type="text"
  inputmode="decimal"
  autocomplete="one-time-code"
/>

Date

<input
  type="date"
/>
<fieldset>
  <legend>Start Date</legend>

  <label for="month">Month (MM)</label>
  <input id="month" type="text" inputmode="decimal" />

  <label for="day">Day (DD)</label>
  <input id="day" type="text" inputmode="decimal" />

  <label for="year">Year (YYYY)</label>
  <input id="year" type="text" inputmode="decimal" />
</fieldset>

And More

  • URLs
  • Credit Cards, Expiration Dates, CVV
  • Birthdays

By solving a11y issues at the
semantic level, we…

improve UIs for existing technology
future-proof them for years to come

Resources

Thanks, Y’all!

James Steinbach

Senior Engineer
at auth0

jdsteinbach

Twitter | GitHub | Blog