Skip to content
easeweb
Search topics

One-time code boxes that won't take a pasted code

A sign-in step asks for a six-digit code in six one-character boxes, so pasting the code from a text message puts in only its first digit.

WCAG 2.2
SC 3.3.8AA· new in 2.2SC 2.1.1A
Required by
Section 508 · EN 301 549 (EU)
Broken <input inputmode="numeric" maxlength="1">
The accessibility problem illustrated: Cognitive:Why did only the 4 go in?
01

The problem

People who can't easily hold six digits in mind, or type them one at a time, have to read the code from one screen and type it into another.

02

Try it

Choose Copy code on the phone, then paste the code into the sign-in page with Ctrl+V or the context menu.

The panel under the window shows what went in. If copying is blocked here, select the code in the message and copy it yourself.

Broken Can you fix this?

Messages

Your Larkspur code is 481902

Check it’s you

Enter the 6-digit code we sent to your phone

What went in: ······

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Take the code whole: one field, or boxes that spread a pasted code across them.

  1. 1Let a pasted, autofilled or dictated code go in whole, in one step.
  2. 2Never cancel paste, and never set maxlength="1" on a code box.
  3. 3Send the code when people press the button, not when the last digit is in.
Before Six boxes that take one character each
<p id="code-label">Enter the 6-digit code we sent to your phone</p><div class="code-boxes" role="group" aria-labelledby="code-label">  <input inputmode="numeric" maxlength="1" aria-label="Digit 1">  <input inputmode="numeric" maxlength="1" aria-label="Digit 2">  <input inputmode="numeric" maxlength="1" aria-label="Digit 3">  <input inputmode="numeric" maxlength="1" aria-label="Digit 4">  <input inputmode="numeric" maxlength="1" aria-label="Digit 5">  <input inputmode="numeric" maxlength="1" aria-label="Digit 6"></div>
After

One field that takes the whole code

<label for="code">Security code</label><p id="code-hint">We sent a 6-digit code to your phone. It works for 15 minutes.</p><input id="code" name="code" type="text" inputmode="numeric"  autocomplete="one-time-code" spellcheck="false" aria-describedby="code-hint"><button type="submit">Continue</button>

Fixing this with an AI coding assistant? Get this guide as Markdown, or get every guide in your coding agent.

04

Verify the fix

5 checks, no mouse.

Test with: Keyboard, Screen reader, Touch, Autofill, Speech input

0 of 5 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the sign-in flow or its code component changes.

Limits

This is a starting pattern, not a guarantee for every sign-in. The example is a code sent by text message; codes from an authenticator app or an email need the same paste test. The criterion doesn't ask a site to send codes by any particular route, and whether the code reaches the device people sign in on is outside it. The rest of signing in, such as a password field that refuses paste or a puzzle to solve, falls under the same criterion. Test the whole sign-in with the people and tools your users rely on.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

Keep this fixed as your code changes.

Turn guides like this into rules your coding agents and CI follow, then have the result retested with a keyboard and screen readers.

How retests work