You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(web): return focus to Edit comment when cancelling a timeline or review comment edit - #47461
When a keyboard user opens Edit comment in the PR Timeline tab or on a Code tab review thread and cancels with Escape or Cancel, focus lands on another timeline control or the Code pane instead of Edit comment.
Change
ConversationCard (Timeline) and ReviewThreadCard (Code tab) now close the editor with flushSync and focus that comment's Edit comment button, as PullRequestTitleEditor does. ReviewThreadCard keeps one button ref per comment, so a multi-comment thread focuses the right one. Save and the reply box are untouched.
Scope
Small bug fix (keyboard focus lost), no issue. Two production files (26 lines, size:S) and their tests; no new copy.
Verification
Setup. Ubuntu 26.04, headless Chromium (1280×820), light theme, empty dev server on each commit, PR sample/sample-repo#1 on a local Forgejo server (the app shows Edit comment only on the viewer's own comments); input sent through the debugging port (Playwright). Steps (Linux). Open PR #1 → Timeline → expand 2 comments → Edit comment → Enter → Escape (repeat via Tab to Cancel → Enter); Code → expand notes.md → Edit comment → Enter → Escape (repeat via Cancel).
Both browser tests (Escape, including a two-comment review thread) fail on 141853b and pass on edb23e5 and on edb23e5 merged with main 43dc7dd; vp run check:changed passes. Pointer Cancel returns focus without :focus-visible. An AI agent ran every check.
Not shown. Desktop (same web bundle), mobile (PullRequestEditScreen), video (no motion/timing).
Macroscope's review found this PR approvable — Cancelling a timeline or review comment edit now returns focus to its Edit comment button without scrolling. The change is limited to local UI focus handling and leaves saving and permissions unchanged.
You can add or adjust custom eligibility rules. Learn more.
Reviewing files that changed from the base of the PR and between edb23e5 and 36b318a.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
When a user cancels editing a pull request comment, both comment interfaces now clear the edit state and restore focus to that comment’s Edit button. Browser tests cover Escape cancellation and focus restoration.
Changes: Edit cancellation focus restoration
Layer / File(s)
Summary
Cancel editing and restore focus apps/web/src/components/pullRequest/PullRequestReviewAnnotation.tsx, apps/web/src/components/pullRequest/PullRequestReviewAnnotation.browser.test.tsx, apps/web/src/components/pullRequest/PullRequestTimelineTab.tsx, apps/web/src/components/pullRequest/PullRequestTimelineTab.browser.test.tsx
Both comment interfaces synchronously clear editing state and restore focus to the relevant Edit button without scrolling. Browser tests verify that Escape closes the editor and restores focus.
This change returns keyboard focus to the correct Edit button after a user cancels a comment edit. It is a small UI change with test coverage for Escape, and no merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title follows the conventional commit format and names the main change: focus returns to the Edit comment button when a timeline or review comment edit is cancelled. The raw summary confirms the c…
Description check
The description follows the template. It has Problem, Change, Scope, and Verification sections. It explains the keyboard focus bug and the flushSync and ref fix. It justifies the lack of an issue as a…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title follows the conventional commit format and names the main change: focus returns to the Edit comment button when a timeline or review comment edit is cancelled. The raw summary confirms the changes to ConversationCard and ReviewThreadCard do exactly this.
Full details: Description check
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections. It explains the keyboard focus bug and the flushSync and ref fix. It justifies the lack of an issue as a small obvious bug fix. Verification lists the setup, steps, before and after screenshots, and test results, and it states what was not checked (desktop, mobile, video). The template's optional agent-model line is present (Gemini 4 Neon). A minor gap is that the Scope section does not link an issue, but the author gives a reason for omitting one.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
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
size:S10-29 changed lines (additions + deletions).takeover:needs-juliusTakeover done; route gate says Julius decidesvouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
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.
Problem
When a keyboard user opens
Edit commentin the PR Timeline tab or on a Code tab review thread and cancels withEscapeorCancel, focus lands on another timeline control or the Code pane instead ofEdit comment.Change
ConversationCard(Timeline) andReviewThreadCard(Code tab) now close the editor withflushSyncand focus that comment'sEdit commentbutton, asPullRequestTitleEditordoes.ReviewThreadCardkeeps one button ref per comment, so a multi-comment thread focuses the right one.Saveand the reply box are untouched.Scope
Small bug fix (keyboard focus lost), no issue. Two production files (26 lines,
size:S) and their tests; no new copy.Verification
Setup. Ubuntu 26.04, headless Chromium (1280×820), light theme, empty dev server on each commit, PR
sample/sample-repo#1on a local Forgejo server (the app showsEdit commentonly on the viewer's own comments); input sent through the debugging port (Playwright).Steps (Linux). Open PR #1 → Timeline → expand
2 comments→Edit comment→Enter→Escape(repeat viaTabtoCancel→Enter); Code → expandnotes.md→Edit comment→Enter→Escape(repeat viaCancel).Timeline Escape jumps to reaction
Timeline Escape focuses Edit comment
Review Escape drops to Code pane
Review Escape focuses Edit comment
Cancel button captures (Timeline and Code)
Timeline Cancel jumps to notes.md:3
Timeline Cancel focuses Edit comment
Review Cancel drops to Code pane
Review Cancel focuses Edit comment
Both browser tests (
Escape, including a two-comment review thread) fail on 141853b and pass on edb23e5 and on edb23e5 merged with main 43dc7dd;vp run check:changedpasses. PointerCancelreturns focus without:focus-visible. An AI agent ran every check.Not shown. Desktop (same web bundle), mobile (
PullRequestEditScreen), video (no motion/timing).Generated with Gemini 4 Neon in T3 Code Nightly