Improve focus handling in the Suggest Reply tone dropdown - #907
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #907 +/- ##
==========================================
Coverage 80.43% 80.43%
Complexity 2565 2565
==========================================
Files 110 110
Lines 10448 10448
==========================================
Hits 8404 8404
Misses 2044 2044
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the 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. |
What?
This PR implements the following:
Why?
The tone dropdown is custom, so Escape dismissal and focus restoration are not provided natively. Closing it while an option has focus can otherwise cause focus to be lost or feel unstable.
How?
The PR adds a keydown listener to handle Escape, updates the dropdown’s hidden and expanded states, and focus the toggle when focus needs to be restored.
Use of AI Tools
AI assistance: Yes
Tool(s): Codex
Model(s): GPT-5.6 Sol
Used for: Code reviews
Screencast
screencast.mov
Changelog Entry
Note:
At the moment, focus is also lost while generation is in progress. This is outside the scope of the current PR and will be addressed in a follow-up.