Skip to content

Fix: Focus inline reply textarea after generating suggestion - #877

Merged
dkotter merged 1 commit into
WordPress:developfrom
Infinite-Null:fix/suggest-reply-focus-textarea-after-generation
Jul 20, 2026
Merged

Fix: Focus inline reply textarea after generating suggestion#877
dkotter merged 1 commit into
WordPress:developfrom
Infinite-Null:fix/suggest-reply-focus-textarea-after-generation

Conversation

@Infinite-Null

@Infinite-Null Infinite-Null commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What?

Fixes an issue where the inline reply textarea fails to retain focus after an AI-suggested reply is generated.

Why?

Previously, when a reply suggestion was generated, the code attempted to focus the textarea while the reply form was still disabled. Because of this the focus was lost.

How?

  • Removed the textarea.focus() call from the populateReplyTextarea function.
  • Moved the textarea.focus() call to the runGeneration function. This ensures the textarea is re-enabled and interactive before attempting to set focus to it.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude
Model(s): Sonnet 4.6
Used for: Code review, PR description

Testing Instructions

  1. Go to the Comments screen in the WordPress admin.
  2. Find a comment and click the "Suggest reply" action link (or click "Reply", then click the "Suggest Reply" button).
  3. Wait for the AI reply to be generated.
  4. Verify that once the generation is complete and the text is inserted, the cursor focus is automatically placed inside the textarea so you can immediately start typing or editing.

Changelog Entry

Fixed - Inline reply textarea not receiving focus after generating a suggested reply.

Before

Screen.Recording.2026-07-17.at.9.43.10.AM.mov

After

Screen.Recording.2026-07-17.at.9.42.24.AM.mov
Open WordPress Playground Preview
@Infinite-Null
Infinite-Null requested a review from a team July 17, 2026 04:33
@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: Infinite-Null <ankitkumarshah@git.wordpress.org>

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

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.44%. Comparing base (8c3606a) to head (8e8cdda).
⚠️ Report is 5 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #877      +/-   ##
=============================================
+ Coverage      78.40%   78.44%   +0.04%     
  Complexity      2454     2454              
=============================================
  Files            104      104              
  Lines           9918     9925       +7     
=============================================
+ Hits            7776     7786      +10     
+ Misses          2142     2139       -3     
Flag Coverage Δ
unit 78.44% <ø> (+0.04%) ⬆️

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.
@dkotter dkotter added this to the 1.3.0 milestone Jul 20, 2026
@dkotter
dkotter merged commit ca3272d into WordPress:develop Jul 20, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants