Skip to content

Improve focus handling in the Suggest Reply tone dropdown - #907

Merged
dkotter merged 1 commit into
WordPress:developfrom
yogeshbhutkar:fix/suggest-reply-a11y
Jul 29, 2026
Merged

Improve focus handling in the Suggest Reply tone dropdown#907
dkotter merged 1 commit into
WordPress:developfrom
yogeshbhutkar:fix/suggest-reply-a11y

Conversation

@yogeshbhutkar

@yogeshbhutkar yogeshbhutkar commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What?

This PR implements the following:

  • Close the tone dropdown when Escape is pressed.
  • Restore focus to the dropdown toggle after selecting an option or pressing Escape.

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

Fixed - Improved keyboard and focus handling for the Suggest Reply tone dropdown.

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.

Open WordPress Playground Preview

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.43%. Comparing base (a1ba294) to head (42c41fb).

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           
Flag Coverage Δ
unit 80.43% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yogeshbhutkar
yogeshbhutkar marked this pull request as ready for review July 29, 2026 05:49
@yogeshbhutkar
yogeshbhutkar requested a review from a team July 29, 2026 05:49
@github-actions

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@dkotter dkotter added this to the 1.3.0 milestone Jul 29, 2026
@dkotter
dkotter merged commit 7e92a70 into WordPress:develop Jul 29, 2026
25 checks passed
@yogeshbhutkar
yogeshbhutkar deleted the fix/suggest-reply-a11y branch July 30, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants