#30023 Chrome autofill password keeps showing in password field - #13231
Draft
skikken wants to merge 1 commit into
Draft
#30023 Chrome autofill password keeps showing in password field#13231skikken wants to merge 1 commit into
skikken wants to merge 1 commit into
Conversation
Chrome autofills the password field after a failed login and keeps displaying it as filled even after the field is emptied via JS, causing an empty password error on submit. Focus and select the field instead of clearing it. Selecting the stale value preserves the overwrite-on-type behavior without fighting browser autofill. Closes #30023
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On the login screen, wp_attempt_focus() clears form fields after a failed login attempt. In Chrome this backfires: after a failed login, the browser autofills the password field, wp_attempt_focus() empties it via JavaScript, but Chrome keeps displaying the field as filled with dots even though it is actually empty. Submitting then fails with "ERROR: The password field is empty."
This removes the field-clearing behavior from wp_attempt_focus(). After a failed attempt, the function now only focuses and selects the relevant field:
Trac ticket: https://core.trac.wordpress.org/ticket/30023
Use of AI Tools
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.