Skip to content
easeweb
Search topics

Password fields that won't take a pasted password

An energy supplier's sign-in cancels paste on its password field, so a password copied from a password manager can't go in and has to be typed from memory.

WCAG 2.2
SC 3.3.8AA· new in 2.2
EN 301 549
Clause 5.3
Broken <input type="password" onpaste="return false">
The accessibility problem illustrated: Cognitive:Why won't my password go in?
01

The problem

People who keep their password in a password manager, or can't remember it exactly, can't paste it in, so they have to recall it or copy it out character by character

02

Try it

Copy the password from the password manager, and paste it into the Password field

Choose Copy password, then paste with Ctrl+V or the context menu. The panel under the page shows how much of the password went in. If copying is blocked here, select the dots in the manager and copy them yourself.

Broken Can you fix this?

BrokenA password field that cancels paste

Password manager

Northbeam Energy [email protected] plum7-Kettle-orbit-48

Sign in to your account

What went in: 0 of 21 characters

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Let people paste or autofill the password

Before
BrokenA password field that cancels paste
<form action="/sign-in" method="post">  <label for="email">Email</label>  <input id="email" name="email" type="email">  <label for="password">Password</label>  <input id="password" name="password" type="password" onpaste="return false">  <button type="submit">Sign in</button></form>
What is wrong3 points
  • The password can't be pasted in: onpaste="return false" cancels every paste into the field, with the keyboard, the context menu or a password manager app.
  • Nothing says the paste was refused: the field just stays empty.
  • So the only way left to enter the password is to remember it or copy it out by hand.
After

A password field that takes a paste and can be filled in

<form action="/sign-in" method="post">  <label for="email">Email</label>  <input id="email" name="email" type="email" autocomplete="username">  <label for="password">Password</label>  <input id="password" name="password" type="password" autocomplete="current-password">  <button type="submit">Sign in</button></form>
How it is fixed3 steps
  1. Remove the paste handler. A password then goes in the way any text does: pasted, dragged in or filled in.
  2. Keep the email and password as real inputs in one form, each with a label.
  3. Add autocomplete="username" and autocomplete="current-password". They tell the browser and password managers what each field holds, so they can offer to fill both and to save a new password.

This is technique H100, with no script needed.* (source 3) It fixes the Before and passes 3.3.8.

04

Verify the fix

4 checks, no mouse.

Test with: Keyboard, Screen reader, Password manager, Autofill

0 of 4 checked

Record the OS, browser, password manager and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the sign-in form or the component library it is built with changes.

Limits

This is a starting pattern, not a guarantee for every sign-in. It covers the password step; every other step of signing in, such as a code, a security question or a puzzle, needs the same test. The criterion covers signing in to an account that exists, not creating one, though setting a password should take a paste for the same reasons. Whether an emailed link reaches people in time depends on their email, which the page can't test. Test the whole sign-in with the password managers 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.

EaseWeb service

Fixed it? Keep it from coming back.

I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.

See the service