Repository navigation
Fix: Restore visible focus state to the button-inside search field - #141
Open
CookieDarb wants to merge 2 commits into
Open
CookieDarb wants to merge 2 commits into
CookieDarb wants to merge 2 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
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.





Description
Closes #140
Restores a visible keyboard focus state on the Search block when configured with the button inside the field.
Why?
When the Search block uses the
button-insidelayout, WordPress Core removes the default input outline (:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input:focus { outline: none; }) without supplying a replacement focus state on the container. As a result, keyboard users navigating into the input field see no visible focus indicator, failing WCAG 2.4.7 (Focus Visible).How?
theme.json:.wp-block-search__inside-wrapperwhen the child input receives focus (:has(.wp-block-search__input:focus)).outline: -webkit-focus-ring-color auto 1px(and standardAccentColorfallback) with0offset, matching the native browser focus indicator displayed on all other form fields throughout the theme without creating double outlines when tabbing onto the search buttonScreencast
Before
Before-search-focus-fix.mov
After
After-search-focus-fix.mov
Testing Instructions
button-insidesearch block (e.g., search results at/?s=helloor the overlay menu).Tabto navigate keyboard focus into the search input field.Tabagain to move focus onto the search button.Use of AI Tools
AI assistance: Yes
Tool(s): Antigravity
Model(s): Gemini
Used for: Reviewing the existing implementation and suggesting the changes. Final decisions and edits were made by me.