Add a password visibility toggle and a Caps Lock indicator to the sign-in and sign-up pages - #27067
Add a password visibility toggle and a Caps Lock indicator to the sign-in and sign-up pages#27067BobDu wants to merge 1 commit into
Conversation
…n-in and sign-up pages The password fields on the login and self-registration pages get an eye button to reveal the typed password, and show an in-field indicator while Caps Lock is on. The sign-up page's previous "Show" checkbox is replaced by the same toggle, and both pages share the same implementation. The built-in password reveal control in Edge and the native WebKit Caps Lock indicator are suppressed on these fields in favor of the cross-browser controls. Signed-off-by: BobDu <i@bobdu.cc>
|
Tentatively doesn't seem worth maintaining this when it's a client problem. |
|
Browser support here is thin though. Edge has a reveal button, Safari draws a caps lock icon, Chrome only does the caps lock icon on macOS, Firefox has neither. The Chromium request for a non-Mac caps lock indicator has been open since 2009 (https://issues.chromium.org/issues/41271565) — a CL finally showed up in review this month, 17 years in, and it wouldn't cover the reveal side anyway. The Firefox one is from 2004 and still NEW (https://bugzilla.mozilla.org/show_bug.cgi?id=259059). WICG discussed standardizing a caps lock warning and the answer was no: "a browser user interface choice (or limitation) and nothing to be standardized" (https://discourse.wicg.io/t/warn-user-if-caps-lock-is-on-when-entering-password/1946). The reason I wrote this: we run Jenkins internally, and the team maintaining it keeps getting "can't log in" tickets that turn out to be caps lock or a typo the user couldn't see. That noise lands on whoever operates the instance, and I doubt we're special — any instance on a username/password realm (LDAP/AD use the same page) should see the same. Core also made this call once already: the sign-up page got a "Show" checkbox in #3380 (2018). This brings the login page up to the same level and replaces the checkbox with the usual eye button. It also fixes the sign-up page currently showing Edge's native reveal control next to its own checkbox. It's ~40 lines of shared JS, no dependencies, no Java, with smoke tests. If you see the two controls differently I'm fine dropping the caps lock part or splitting the PR. |
I'm in agreement. |
|
How about I drop the caps lock indicator and keep only the reveal toggle? For caps lock there's at least a CL in flight on the Chromium side, so I can see waiting for the browser there. The reveal button is a different story, because the standards discussion settled it the other way around. CSSWG adopted Core already made that call for the sign-up page: "Show" has been there since #3380 and survived the #7872 revamp. The trimmed PR is mostly the login page catching up, with the checkbox replaced by the usual eye button and one shared implementation for both pages. If that works I'll update the PR to drop the caps lock part. |
Generated with core pull request: * jenkinsci/jenkins#27206 Includes pull requests: * jenkinsci/jenkins#27205 * jenkinsci/jenkins#27201 * jenkinsci/jenkins#27193 * jenkinsci/jenkins#27163 * jenkinsci/jenkins#27088 * jenkinsci/jenkins#27083 * jenkinsci/jenkins#27067 * jenkinsci/jenkins#27065 * jenkinsci/jenkins#27063 * jenkinsci/jenkins#27032 * jenkinsci/jenkins#26923 * jenkinsci/jenkins#26922 * jenkinsci/jenkins#26913 * jenkinsci/jenkins#26880 * jenkinsci/jenkins#26690 * jenkinsci/jenkins#26668 * jenkinsci/jenkins#26600 * jenkinsci/jenkins#26587 * jenkinsci/jenkins#11216 * jenkinsci/jenkins#10432 * jenkinsci/jenkins#8559
The username/password login page and the self-registration page currently provide no way to see the typed password and no warning when Caps Lock is on:
<input type="password">. Chrome and Firefox users get neither a reveal control nor a Caps Lock indicator from the browser (Edge ships a native reveal button and WebKit draws a native Caps Lock icon; the other browsers have neither).This change adds to both pages:
<button>with a fixed accessible name andaria-pressed, following the ARIA toggle button pattern, and is only shown when JavaScript is available.keydown/keyup/mousedownevents page-wide, so the indicator also appears when the field is entered with Caps Lock already on.The sign-up page's "Show" checkbox is replaced by the same toggle, and both pages share one implementation (
src/main/js/util/password-field.js). The built-in password reveal control in Edge (::-ms-reveal) and the native WebKit Caps Lock indicator (::-webkit-caps-lock-indicator) are suppressed on these fields in favor of the cross-browser controls, and the now-unused "Show" translations are removed. Form field names and submission endpoints are unchanged, and no Java code is touched.Testing done
HudsonPrivateSecurityRealmTest#signupPageHasPasswordVisibilityToggleAndCapsLockIndicator,#loginPageHasPasswordVisibilityToggleAndCapsLockIndicator); the existingsignup()andanonymousCantSignup()tests still pass.aria-pressed, and does not affect form submission; logging in and registering complete end to end;password2synchronization on the sign-up page keep working;yarn lintpasses.Screenshots (UI changes only)
Before
After
Proposed changelog entries
Proposed changelog category
/label rfe,web-ui
Proposed upgrade guidelines
N/A
Submitter checklist
@Restrictedor have@since TODOJavadocs, as appropriate.@Deprecated(since = "TODO")or@Deprecated(forRemoval = true, since = "TODO"), if applicable.evalto ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
Before the changes are marked as
ready-for-merge:Maintainer checklist
upgrade-guide-neededlabel is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidateto be considered.