Preventing paste in form fields is security theater that actively harms your users. It blocks password managers, forces manual typing of complex passwords, and makes forms slower for everyone - while providing zero actual security benefit.
Some input fields have JavaScript that intercepts the paste event and cancels it, or CSS that disables clipboard functionality. This typically appears on:
The intent is usually to force users to "prove" they typed correctly. In practice, it:
onpaste attribute in HTMLpaste listenersuser-select: none or -webkit-user-select: nonedocument.querySelectorAll('input, textarea').forEach((el) => {
const events = getEventListeners(el)
if (events.paste) {
console.warn('Paste blocked on:', el, events.paste)
}
})
The audit "Prevents users from pasting into input fields" lists each offending element with its DOM location and input type.
Find and delete the code blocking paste:
Before (bad):
<!-- HTML attribute -->
<input type="password" onpaste="return false">
<!-- Inline handler -->
<input type="email" onpaste="event.preventDefault()">
After (good):
<input type="password">
<input type="email">
JavaScript event listener:
// Bad: Blocking paste
passwordInput.addEventListener('paste', e => e.preventDefault())
// Good: Remove the listener entirely, or just delete this code
The "retype your email" pattern doesn't catch errors anyway. Users who mistype their email will mistype it the same way twice.
Before:
<input type="email" name="email" placeholder="Email">
<input type="email" name="email_confirm" placeholder="Confirm email" onpaste="return false">
After:
<input type="email" name="email" placeholder="Email">
Add email verification by sending a confirmation link. That's actual validation.
If product requirements demand confirmation fields, at least let users paste:
<label>
Password
<input type="password" name="password" autocomplete="new-password">
</label>
<label>
Confirm Password
<input type="password" name="password_confirm" autocomplete="new-password">
</label>
Both fields allow paste. Password managers fill both. Users with manual passwords can paste into both. Validation happens on submit:
form.addEventListener('submit', (e) => {
const password = form.password.value
const confirm = form.password_confirm.value
if (password !== confirm) {
e.preventDefault()
showError('Passwords do not match')
}
})
Some implementations use CSS to prevent text selection and pasting:
Before (bad):
.secure-input {
user-select: none;
-webkit-user-select: none;
}
After (good):
/* Just remove these properties */
.secure-input {
/* Let users interact normally */
}
Some form libraries or payment processors add paste prevention. Check their configuration:
// Example: Some validation libraries
const form = new FormValidator({
preventPaste: false, // Disable this
// ...
})
For embedded payment forms (Stripe, etc.), check their documentation for paste-related settings.
Cmd/Ctrl+V)Test with a password manager:
Run Lighthouse - the "Prevents users from pasting into input fields" audit should pass.
readonly prevents all input. That's not the same as a functional field that accepts paste.paste event. Blocking paste may work inconsistently anyway.The argument for blocking paste is usually "users should verify what they're typing." Here's why that's backwards:
john@gmial.com, they'll type it wrong both times.NCSC (UK National Cyber Security Centre) explicitly recommends against blocking paste in their password guidance.
Paste prevention often appears on specific pages: signup, checkout, account settings. Unlighthouse scans your entire site and flags every input with paste prevention, across all forms.
Notifications
Stop requesting notification permission on page load. Users dismiss these prompts reflexively - wait for a user action that shows they want notifications.
HTTP Redirect
Configure your server to redirect all HTTP traffic to HTTPS. Protect users and enable secure web features across your entire site.