Repository navigation
Components: Synchronize popup hover and keyboard targets (7.2 backport) - #85829
Conversation
* Components: Prioritize keyboard targets over popup hover styles * Fix single popup highlight changelog reference * Components: Synchronize popup hover and keyboard targets * MenuItem: Preserve consumer focus on hover * DropdownMenu: Use real pointer interaction in scroll test * MenuItem: Require explicit cancellation of hover focus * MenuItem: Keep hover focus within the active menu --- Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org>
🤖 PR meta 🤖🎉 PropsIf 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. Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +150 B (0%) Total Size: 9.04 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. As a user I expect my navigation to use the colors I selected for it in
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the backport synchronizing pointer and keyboard targets in popup menus and autocomplete results.
No open issues 🎉
What changed in this PR
Backports #85487 to WordPress 7.2, synchronizing pointer and keyboard targets in @wordpress/components popup menus and autocomplete results.
Changes:
- Adds hover-driven menu focus and autocomplete selection while preserving consumer cancellation and text-input focus.
- Adds browser and unit coverage, with autocomplete fixtures adapted for 7.2.
- Records the backported fix in the components changelog.
| File | Description |
|---|---|
| packages/components/src/menu-item/test/index.jsdom.test.tsx | Tests focus boundaries and consumer hover-handler cancellation. |
| packages/components/src/menu-item/index.tsx | Adds cancellable hover focus within the active menu. |
| packages/components/src/dropdown-menu/test/index.browser.test.tsx | Tests hover focus, keyboard continuation, disabled items, and scroll preservation. |
| packages/components/src/dropdown-menu/index.tsx | Focuses hovered controls without scrolling. |
| packages/components/src/autocomplete/types.ts | Adds the hover callback type. |
| packages/components/src/autocomplete/test/index.jsdom.test.tsx | Supplies the required hover callback in the existing fixture. |
| packages/components/src/autocomplete/test/index.browser.test.tsx | Tests hover selection and keyboard completion while retaining input focus. |
| packages/components/src/autocomplete/index.tsx | Connects hover events to selection state. |
| packages/components/src/autocomplete/autocompleter-ui.tsx | Forwards pointer movement to the hover callback. |
| packages/components/CHANGELOG.md | Documents the synchronization fix. |
Review effort: Balanced
Backports #85487 to
wp/7.2.What?
Synchronize pointer and keyboard targets in DropdownMenu, MenuItem, and Autocomplete.
Why?
Hover and keyboard navigation can identify different items. The automatic backport failed on a components changelog conflict.
How?
Apply
a91cfa3bafa1aec63d22fca043068adaf43df652, adding only its changelog entry. Runtime changes match the merged PR. The Autocomplete browser test supplies emptykeywordsarrays because that field is still required on 7.2.Testing Instructions
onMouseMovehandler that callsevent.preventDefault()must retain control of focus across repeated pointer movement.Testing Instructions for Keyboard
Local verification
The production build, components typecheck, and focused lint passed. All 66 focused unit and Chromium browser tests passed. Five imported browser checks fail on the original 7.2 runtime and pass with this backport. The editor steps above remain manual verification instructions.
Use of AI Tools
Codex applied the backport, resolved the changelog conflict, adapted the test fixtures, ran local verification, and drafted this description.