Add pattern attribute to password fields for better compatibility

Created on 25 August 2025, about 2 months ago

Problem/Motivation

The Password Policy module is responsible for defining password constraints, but the password input fields themselves don't communicate these constraints to the browser or other applications like password managers.

According to the MDN documentation for <input type="password">, using the pattern attribute is a recommended way to provide validation hints. This allows password managers, such as 1Password, to better understand and validate generated passwords against the policy requirements.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/inp...

Proposed resolution

Add the pattern attribute to all elements when a password policy is enabled. The value of this attribute should be a regular expression that accurately reflects the constraints defined by the active password policy.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

4.0

Component

User interface

Created by

🇯🇵Japan gengo_k Osaka

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024