Repository navigation
fix(focus return): a layer that closes while focus moves from inside it to another control leaves focus there - #13555
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 00d59e0 |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DateInput · Storybook | 209.8 kB (+99 B) · 19.0 kB CSS (0) | 6,363 (0) | ✗ · ✓ · ✓ |
| lab/TransferListSelector | 152.1 kB (+149 B) · 1.4 kB CSS (0) | — | — · — · — |
| Selector | 121.7 kB (+140 B) · 19.7 kB CSS (0) | — | — · — · — |
76 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| ChatComposerTokenElement | 88.2 kB (+120 B) · 12.5 kB CSS (0) | — | — · — · — |
| ChatComposerInput | 88.2 kB (+119 B) · 12.5 kB CSS (0) | — | — · — · — |
| ComplexSelector | 84.2 kB (+117 B) · 13.3 kB CSS (0) | — | — · — · — |
| AlertDialog | 134.6 kB (+115 B) · 16.3 kB CSS (0) | — | — · — · — |
| Drawer | 58.5 kB (+115 B) · 8.7 kB CSS (0) | — | — · — · — |
| MultiSelector | 109.9 kB (+113 B) · 18.9 kB CSS (0) | — | — · — · — |
| ChatComposer | 91.1 kB (+111 B) · 13.5 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 82.3 kB (+110 B) · 13.1 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 103.1 kB (+107 B) · 14.0 kB CSS (0) | — | — · — · — |
| PowerSearch | 320.6 kB (+107 B) · 27.3 kB CSS (0) | — | — · — · — |
| Typeahead | 95.3 kB (+107 B) · 14.4 kB CSS (0) | — | — · — · — |
| DropdownMenu | 133.3 kB (+106 B) · 19.8 kB CSS (0) | — | — · — · — |
| Pagination | 154.9 kB (+106 B) · 20.1 kB CSS (0) | — | — · — · — |
| MoreMenu | 133.6 kB (+105 B) · 19.8 kB CSS (0) | — | — · — · — |
| Tokenizer | 113.2 kB (+105 B) · 21.9 kB CSS (0) | — | — · — · — |
| Popover | 105.8 kB (+104 B) · 15.5 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 187.1 kB (+104 B) · 1.9 kB CSS (0) | — | — · — · — |
| TabMenu | 84.9 kB (+100 B) · 12.3 kB CSS (0) | — | — · — · — |
| DateRangeInput | 106.8 kB (+99 B) · 14.2 kB CSS (0) | — | — · — · — |
| SideNavHeading | 88.7 kB (+99 B) · 12.5 kB CSS (0) | — | — · — · — |
| lab/Comments | 390.7 kB (+99 B) · 2.5 kB CSS (0) | — | — · — · — |
| CommandPalette | 84.1 kB (+98 B) · 13.5 kB CSS (0) | — | — · — · — |
| ContextMenuItem | 39.2 kB (+98 B) · 7.3 kB CSS (0) | — | — · — · — |
| SideNavItem | 83.0 kB (+98 B) · 12.3 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 130.5 kB (+97 B) · 1.1 kB CSS (0) | — | — · — · — |
| TopNavMenu | 87.9 kB (+96 B) · 12.4 kB CSS (0) | — | — · — · — |
| TopNavHeading | 88.4 kB (+95 B) · 12.4 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 383.8 kB (+95 B) · 2.4 kB CSS (0) | — | — · — · — |
| DateTimeInput | 234.1 kB (+94 B) · 20.7 kB CSS (0) | — | — · — · — |
| BaseTypeahead | 84.4 kB (+93 B) · 12.1 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 317.0 kB (+93 B) · 454 B CSS (0) | — | — · — · — |
| Dialog | 28.9 kB (+90 B) · 7.3 kB CSS (0) | — | — · — · — |
| lab/MediaCaptionsButton | 229.5 kB (+90 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaPlaybackRate | 229.5 kB (+90 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaPlayButton | 229.5 kB (+90 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaSeekButton | 229.5 kB (+90 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaTime | 229.5 kB (+90 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaTimeSlider | 229.5 kB (+90 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaVolume | 229.5 kB (+90 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/VideoPlayer | 236.8 kB (+90 B) · 2.1 kB CSS (0) | — | — · — · — |
| lab/MediaFullscreenButton | 229.5 kB (+89 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/AudioPlayer | 239.2 kB (+87 B) · 1.8 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 129.3 kB (+87 B) · 773 B CSS (0) | — | — · — · — |
| lab/Schedule | 119.2 kB (+3 B) · 3.9 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 107.8 kB (+2 B) · 20.0 kB CSS (0) | — | — · — · — |
| Markdown | 210.8 kB (+1 B) · 23.5 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 78.4 kB (+1 B) · 14.6 kB CSS (0) | — | — · — · — |
| ButtonGroup | 44.9 kB (0) · 3.7 kB CSS (0) | — | — · — · — |
| ChatLayout | 91.6 kB (0) · 11.7 kB CSS (0) | — | — · — · — |
| DropdownMenuItem | 28.7 kB (0) · 7.1 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 80.9 kB (0) · 11.0 kB CSS (0) | — | — · — · — |
| LayoutPanel | 22.4 kB (0) · 5.1 kB CSS (0) | — | — · — · — |
| Lightbox | 151.6 kB (0) · 12.3 kB CSS (0) | — | — · — · — |
| NavHeadingMenu | 19.1 kB (0) · 3.5 kB CSS (0) | — | — · — · — |
| TimeInput | 182.2 kB (0) · 17.9 kB CSS (0) | — | — · — · — |
| TreeList | 47.5 kB (0) · 6.0 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 61.8 kB (0) · 1.2 kB CSS (0) | — | — · — · — |
| lab/TabBar | 84.7 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| lab/TabBarItem | 3.9 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| lab/TourStep | 97.3 kB (0) · 691 B CSS (0) | — | — · — · — |
| BottomSheetSwitcher | 19.6 kB (−1 B) · 3.4 kB CSS (0) | — | — · — · — |
| Collapsible | 30.1 kB (−1 B) · 4.5 kB CSS (0) | — | — · — · — |
| ContextMenu | 106.7 kB (−1 B) · 19.6 kB CSS (0) | — | — · — · — |
| DropdownMenuRadioItem | 29.6 kB (−1 B) · 7.6 kB CSS (0) | — | — · — · — |
| TabList | 48.5 kB (−1 B) · 6.8 kB CSS (0) | — | — · — · — |
| Toolbar | 48.4 kB (−1 B) · 8.6 kB CSS (0) | — | — · — · — |
| lab/NavigationScreen | 86.6 kB (−1 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/NavigationStack | 86.6 kB (−1 B) · 1.5 kB CSS (0) | — | — · — · — |
| AvatarGroup | 49.8 kB (−2 B) · 6.1 kB CSS (0) | — | — · — · — |
| DropdownMenuCheckboxItem | 29.6 kB (−2 B) · 7.6 kB CSS (0) | — | — · — · — |
| SideNav | 116.3 kB (−2 B) · 12.6 kB CSS (0) | — | — · — · — |
| TableCell | 107.9 kB (−2 B) · 20.2 kB CSS (0) | — | — · — · — |
| BottomSheet | 76.9 kB (−3 B) · 7.8 kB CSS (0) | — | — · — · — |
| SegmentedControl | 103.7 kB (−5 B) · 7.2 kB CSS (0) | — | — · — · — |
| Table | 126.1 kB (−5 B) · 21.2 kB CSS (0) | — | — · — · — |
| AppShell | 92.2 kB (−6 B) · 14.9 kB CSS (0) | — | — · — · — |
Visual changes: 6 snapshots in 1 component
A change is a question for the reviewer, not a failure.
Inheritance checked against the 8 newest reports of other pull requests.
Package size: @astryxdesign/core 8.00 MB packed (+628 B); no new dependencies.
Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Requesting changes. The fix works for the reported DateInput case, but the changeset and the amended FR17 claim more than the code covers.
- A layer that closes from a native
blurlistener while focus moves to another control still sends focus back to its opener, because the record notes the move onfocusout(packages/core/src/utils/focusReturn.ts:497) and browsers fireblurfirst; listen forblurin the capture phase there (it reaches the document before the element's ownblurandfocusoutlisteners, with the samerelatedTarget) and add a unit case that closes from a nativeblurlistener, or narrow the changeset, FR17 and the code comment to closes that run from afocusout(ReactonBlur) handler.
In Chromium, a press on the second DateInput now keeps focus and the typed text in that field, and Escape and a press on empty space still return focus to the calendar button. The inline comments add two non-blocking points: the browser spec's toHaveValue(/1/) already matches the field's prefilled "Mar 21, 2026", and two new source comments can be shorter and more exact.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Changeset: an overlay that closes while focus moves to another control no longer pulls focus back to its opener. False as written: true for a close from a
focusouthandler, false for a close from a nativeblurlistener (checked in Chromium). - Changeset: from a focused calendar day, a press on a second DateInput keeps focus there and typing reaches it. Verified in Chromium; on the base, focus went to the first field's calendar button and the typed key was lost.
- Changeset: Escape still returns focus to the opener. Verified in Chromium.
- Changeset: a patch release of core. Verified.
- Description, before and after: on the base, focus went to the first field's calendar button and typing was lost; at the head, the second field keeps focus and takes the typed text. Verified in Chromium.
- Description, unchanged behavior: Escape and a press on empty page space still return focus, and focus that already left stays. Verified in Chromium and by the existing unit case.
- Description, cause: DateInput closes from the field's
focusoutwhile focus is on the body. Verified (DateInput.tsx:890-905; Chromium reports the body duringfocusout). - Description, change: the record notes the outside control from
focusoutto the nextfocusin, clears it after one task, and the stranded test treats it as focus outside. Verified (focusReturn.ts:470-488,:719-726). - Description: every overlay on the shared return gets this. Verified (the shared focus trap's users and Dialog).
- Description: FR17 names the case and the verification row names the new tests. Verified (
spec.md:182-184,:369). - Description: the browser test fails on main and passes here. Verified with an equivalent Chromium run of its steps.
- Description: the two unit cases are not red on main. Verified: they pass on the base.
- Description: the listed unit suites pass. Verified with a larger set: 6,209 of 6,209.
- Description: types, formatting and the knowledge check are clean. Verified.
- File
.changeset/close-keeps-focus-moving-elsewhere.md: the blocking finding (claim scope). - File
docs/specs/AST-116-popover-anchoring/spec.md: clear, apart from the same scope point in FR17's parenthetical. - File
packages/core/src/DateInput/__tests__/DateInputSecondFieldFocus.interaction.browser.spec.ts: non-blocking (the typed-text check cannot fail; the header says four fields, the story has five). - File
packages/core/src/utils/focusReturn.ts: the blocking finding at line 497; non-blocking comment wording at lines 466-469 and 481. - File
packages/core/src/utils/layerFocusReturn.test.tsx: clear.
… blur close sees it too
|
/approve-spec 4c15d8d |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet.
The capture-phase blur note closes the earlier gap: a layer that closes from a native blur listener during a focus move now leaves focus on the outside control, so the release note, the spec text and the code comment match the code. Two non-blocking points are inline: the new native-blur unit case passes even without the fix, and the browser spec header miscounts the story's fields.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Changeset: an overlay that closes while focus moves to another control no longer pulls focus back to its opener. Verified for closes from a
focusouthandler and from a nativeblurlistener (Chromium probe offocusReturn.ts;:466-505,:720-727). - Changeset: from a focused calendar day, a press on a second DateInput keeps focus in that field and typing reaches it. Verified in Chromium (the typed key lands in the second field; on the base, focus goes to the first field's calendar button).
- Changeset: Escape still returns focus to the opener. Verified in Chromium.
- Changeset: a patch release of core. Verified.
- Description, before and after for keyboard users of DateInput. Verified in Chromium.
- Description, unchanged: Escape and a press on empty space still return focus, and focus that already left stays. Verified (Chromium Escape; the no-target probe and unit cases).
- Description, cause: DateInput closes its calendar from the field's
focusoutwhile nothing is focused. Verified (DateInput.tsx:890-905; the page reports the body during the move). - Description, change: the record notes the outside target from a capture-phase
blurto the nextfocusin, clears it after one task, and the stranded check treats the move as focus outside. Verified (focusReturn.ts:466-505,:720-727). - Description: every overlay on the shared return gets this. Verified (the shared focus trap and Dialog).
- Description: the spec names the case and its verification row names the new tests. Verified (
spec.md:182-184,:369). - Description: the browser spec covers the press from a grid day and the Escape control. Verified (
DateInputSecondFieldFocus.interaction.browser.spec.ts:70-104). - Description: the unit cases cover focusout, native blur and no-target closes. Verified that they exist and pass; the native blur case cannot fail (non-blocking).
- Description: the browser test fails on main and passes here. Verified (Chromium).
- Description: the unit cases are not red on main. Verified (they pass on the base).
- Description: the listed unit suites pass. Verified with a larger set (291 test files).
- Description: the DateInput focus specs and the Popover and Dialog interaction specs pass in Chromium, 59. Verified (59 passed).
- Description: types, formatting and the knowledge check are clean. Verified.
- File
.changeset/close-keeps-focus-moving-elsewhere.md: clear. - File
docs/specs/AST-116-popover-anchoring/spec.md: clear. - File
packages/core/src/DateInput/__tests__/DateInputSecondFieldFocus.interaction.browser.spec.ts: non-blocking (the header counts four fields; the story has five). - File
packages/core/src/utils/focusReturn.ts: clear. - File
packages/core/src/utils/layerFocusReturn.test.tsx: non-blocking (the native blur case passes without the fix).
|
|
||
| /** | ||
| * @file DateInputSecondFieldFocus.interaction.browser.spec.ts | ||
| * @input Storybook story core-dateinput--formats (four DateInput fields) |
There was a problem hiding this comment.
Non-blocking (header). core-dateinput--formats renders five DateInput fields, not four.
* @input Storybook story core-dateinput--formats (five DateInput fields)|
/approve-spec a468279 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet.
Merging main changed none of this pull request's files. A layer that closes from a focusout or a native blur listener during a focus move leaves focus on the outside control, and the release note and the amended spec text match the code. Two non-blocking points stay open in the existing inline threads: the native-blur unit case passes even without the fix, and the browser spec header says the story has four fields where it renders five.
Claims and files checked
Review mode: carry-forward; reason: none
- The run-based checks below (Chromium, unit suites, types, formatting) were made on this same patch before the
mainmerge, which changes none of its files. - Changeset: an overlay that closes while focus moves to another control no longer pulls focus back to its opener. Verified for closes from a
focusouthandler and from a nativeblurlistener (Chromium probe offocusReturn.ts;:466-505,:720-727). - Changeset: from a focused calendar day, a press on a second DateInput keeps focus in that field and typing reaches it. Verified in Chromium (the typed key lands in the second field; on the base, focus goes to the first field's calendar button).
- Changeset: Escape still returns focus to the opener. Verified in Chromium.
- Changeset: a patch release of core. Verified.
- Description, before and after for keyboard users of DateInput. Verified in Chromium.
- Description, unchanged: Escape and a press on empty space still return focus, and focus that already left stays. Verified (Chromium Escape; the no-target probe and unit cases).
- Description, cause: DateInput closes its calendar from the field's
focusoutwhile nothing is focused. Verified (DateInput.tsx:890-905; the page reports the body during the move). - Description, change: the record notes the outside target from a capture-phase
blurto the nextfocusin, clears it after one task, and the stranded check treats the move as focus outside. Verified (focusReturn.ts:466-505,:720-727). - Description: every overlay on the shared return gets this. Verified (the shared focus trap and Dialog).
- Description: the spec names the case and its verification row names the new tests. Verified (
spec.md:182-184,:369). - Description: the browser spec covers the press from a grid day and the Escape control. Verified (
DateInputSecondFieldFocus.interaction.browser.spec.ts:70-104). - Description: the unit cases cover focusout, native blur and no-target closes. Verified that they exist and pass; the native blur case cannot fail (non-blocking).
- Description: the browser test fails on main and passes here. Verified (Chromium).
- Description: the unit cases are not red on main. Verified (they pass on the base).
- Description: the listed unit suites pass. Verified with a larger set (291 test files).
- Description: the DateInput focus specs and the Popover and Dialog interaction specs pass in Chromium, 59. Verified (59 passed).
- Description: types, formatting and the knowledge check are clean. Verified.
- File
.changeset/close-keeps-focus-moving-elsewhere.md: clear. - File
docs/specs/AST-116-popover-anchoring/spec.md: clear. - File
packages/core/src/DateInput/__tests__/DateInputSecondFieldFocus.interaction.browser.spec.ts: non-blocking (the header counts four fields; the story has five). - File
packages/core/src/utils/focusReturn.ts: clear. - File
packages/core/src/utils/layerFocusReturn.test.tsx: non-blocking (the native blur case passes without the fix).
There was a problem hiding this comment.
Changes requested.
- Miss: the title and release note say any popover, dialog or menu that closes while focus moves to another control leaves focus there, but
focusReturn.tsnotes the move only when it starts inside the layer (line 477), so with the first DateInput's calendar open and focus in that field's own text, a press on the second field still sends focus back to the first field's calendar button in Chromium and the typed text is lost; either note every move to an outside element while the layer is open and add that case to the browser spec, or narrow the title, release note and the spec's new clause to a close while focus leaves the layer.
The reported case is fixed: from a focused calendar day, a press on the second field now keeps focus and the typed text there, and Escape still returns focus to the calendar button. Two non-blocking points stay open in their inline threads: the native blur unit case passes without the fix, and the browser spec header says four fields where the story renders five.
Claims and files checked
Review mode: same-head; reason: none
- Release note, an overlay that closes while focus moves to another control no longer pulls focus back to its opener: false for a move that starts outside the layer. In Chromium at this head, focus returns to the first calendar button.
- Release note, a press on a second DateInput from a focused calendar day keeps focus and typing in that field: verified in Chromium (fails on the base, passes here).
- Release note, Escape still returns focus to the opener: verified in Chromium.
- Release note, a patch release of core: verified.
- Description, primary intent: the same broad claim as the release note, and false for the same case.
- Description, before and after for keyboard users of DateInput: verified in Chromium.
- Description, unchanged behavior (Escape and a press on empty space still return focus, and focus already outside stays): verified by the Escape run, the no-target unit case and the otherwise unchanged stranded check.
- Description, cause (the field's blur handler closes the calendar while nothing is focused, and the shared return focuses the opener): verified by a focus-call trace on the base.
- Description, change (the record notes the outside target from a capture-phase blur until the next focusin, clears it after one task, and the stranded check treats the move as outside): verified, for a blur that starts inside the layer only.
- Description, every overlay on the shared return gets this: verified (the shared focus trap and Dialog).
- Description, the spec names the case and its verification row names the new tests: verified.
- Description, the browser spec covers the press from a calendar day and the Escape control: verified. It passes in CI's full Chromium interaction run at this head.
- Description, the unit cases cover a close from focusout, from native blur and with no target: they exist and pass. The native blur case also passes without the fix (non-blocking).
- Description, the browser test fails on main and passes here: verified in Chromium.
- Description, the unit, browser, type, formatting and knowledge checks pass: CI's checks pass at this head.
- Description, writing rubric: the new spec text is in the present tense, and the verification row names test files only. Verified.
- File
.changeset/close-keeps-focus-moving-elsewhere.md: blocking (claims more than the code covers). - File
docs/specs/AST-116-popover-anchoring/spec.md: part of the blocking finding (the new clause's main text reads wider than its example and the code). - File
packages/core/src/DateInput/__tests__/DateInputSecondFieldFocus.interaction.browser.spec.ts: non-blocking (the header counts four fields, but the story has five). - File
packages/core/src/utils/focusReturn.ts: blocking (a move that starts outside the layer is not noted). - File
packages/core/src/utils/layerFocusReturn.test.tsx: non-blocking (the native blur case passes without the fix).
…jsdom cases count the opener's focus
|
/approve-spec 1b91ef8 |
There was a problem hiding this comment.
Changes requested.
- The description's Evidence section says the two jsdom cases "are not red on main", but both new cases in
layerFocusReturn.test.tsxnow fail on main (the opener takes focus once) and pass here, as the Tests bullet says, so please correct that sentence and the "4,713/4,713" tally, which is 4,792 cases at this head.
The reported case is fixed: from a focused calendar day, a press on the second DateInput keeps focus and the typed text there, the new Chromium spec fails on main and passes here, and Escape still returns focus to the calendar button. The narrowed title and release note settle the earlier scope point. Two non-blocking points: FR17's new clause could say "moving from inside the layer to a control outside it" to match the code (inline comment), and the browser spec's header says four fields where the Formats story renders five.
Claims and files checked
Review mode: incremental; reason: none
- Release note, an overlay that closes while focus moves from inside it to another control no longer pulls focus back to its opener: verified (the blur note and the stranded check, and Chromium).
- Release note, a press on a second DateInput from a focused calendar day keeps focus and typing there: verified in Chromium (fails on main, passes here).
- Release note, Escape still returns focus to the opener: verified in Chromium on main and here.
- Release note, a patch release of core: verified.
- Description, primary intent, the same rule for a move that starts inside the layer: verified.
- Description, a move that starts outside the layer is not affected: verified (the note requires a blur from inside the layer; Chromium behaves as on main).
- Description, fixes the linked issue: verified with the issue's steps in the Formats story.
- Description, before and after for keyboard users of DateInput: verified in Chromium.
- Description, unchanged behavior (Escape and a close with nothing focused still return focus; focus already outside stays): verified by the Escape run and the no-target unit case.
- Description, cause (the field's focusout closes the calendar while nothing is focused, and the shared return focuses the opener): verified in the code and on main in Chromium.
- Description, change (the note from a capture-phase blur until the next focusin, cleared after one task, honoured by the stranded check, for every overlay on the shared return): verified.
- Description, the spec names the case and its verification row names the new tests: verified.
- Description, the browser spec covers the press from a calendar day and the Escape control: verified.
- Description, the two jsdom cases from focusout and from native blur never focus the opener and fail on main; the no-target case returns focus: verified (both fail on main, pass here).
- Description, the browser spec fails on main and passes here, and the existing focus-leave cases pass on both: verified in Chromium.
- Description, the named unit suites pass, 4,713 of 4,713: they pass; this head runs 4,792 cases in them.
- Description, the DateInput focus specs and the Popover and Dialog interaction specs pass: verified (one frame-timing proof failed with two workers and passes on its own, on main and here).
- Description, the jsdom cases are not red on main: false (both fail on main).
- Description, type check, formatting and knowledge checks are clean: formatting and knowledge checks verified; the core build's type check passes.
- Description, writing rubric: the new spec text is in the present tense and the verification row names test files only: verified.
- File
.changeset/close-keeps-focus-moving-elsewhere.md: clear. - File
docs/specs/AST-116-popover-anchoring/spec.md: non-blocking (the new clause's main text reads wider than its parenthetical). - File
packages/core/src/DateInput/__tests__/DateInputSecondFieldFocus.interaction.browser.spec.ts: non-blocking (the header counts four fields, the story has five). - File
packages/core/src/utils/focusReturn.ts: clear. - File
packages/core/src/utils/layerFocusReturn.test.tsx: clear; the description's account of it is the blocking finding.
| a caller moved in its own hide notification, and focus that is moving to a | ||
| control outside the layer when the layer closes (a close that runs while | ||
| focus leaves the layer for that control, such as a press on another field). |
There was a problem hiding this comment.
Non-blocking (wording). The main text, "focus that is moving to a control outside the layer when the layer closes", also covers a press on another field made after focus went back from the calendar to the field's own text. In that case focus still returns to the opener, because focusReturn.ts notes only a blur from inside the layer. The parenthetical and the release note already limit the case. Say so in the main text too:
a caller moved in its own hide notification, and focus that is moving from
inside the layer to a control outside it when the layer closes (a close that
runs while focus leaves the layer for that control, such as a press on
another field).
There was a problem hiding this comment.
Approved. CI passed on this head.
The fix does what the release note says: a popover or menu that closes while focus moves from inside it to another control leaves focus on that control, and the new browser and unit cases fail on main and pass here. Two non-blocking points stay open in their inline threads: the record's new sentence could say "moving from inside the layer to a control outside it" to match the code, and the browser spec's header says four fields where the Formats story renders five.
Claims and files checked
Review mode: same-head; reason: none
- Release note, an overlay that closes while focus moves from inside it to another control no longer pulls focus back to its opener: verified (the blur note and the stranded check, and the unit cases).
- Release note, a press on a second DateInput from a focused calendar day keeps focus and typing there: verified in Chromium (fails on main, passes here).
- Release note, Escape still returns focus to the opener: verified in Chromium on main and here.
- Release note, a patch release of core: verified.
- Description, primary intent, a move from inside the layer only, with a move that starts outside unaffected: verified (the note requires a blur from inside the layer).
- Description, fixes the linked issue, reported with a reproduction and an event trace: verified.
- Description, before and after for keyboard users of DateInput: verified in Chromium.
- Description, unchanged behavior (Escape and a close with nothing focused still return focus; focus already outside stays): verified by the Escape case and the no-target unit case.
- Description, cause (the field's focusout closes the calendar while nothing is focused, and the shared return focuses the opener): verified in the code.
- Description, change (the note from a capture-phase blur until the next focusin, cleared after one task, honoured by the stranded check, for every overlay on the shared return): verified.
- Description, the record names the case and its verification row names the new tests: verified.
- Description, the browser spec covers the press from a calendar day and the Escape control: verified.
- Description, the unit cases from focusout and from a native blur never focus the opener and fail on main; the no-target case returns focus: verified (rerun: both fail on main, pass here).
- Description, the changeset is a patch fix: verified.
- Description, the record amendment and its owner approval for this head: verified.
- Description, the browser spec fails on main and passes here, and the existing focus-leave cases pass on both: verified in Chromium.
- Description, the named unit suites pass, 4,792 cases: verified.
- Description, the DateInput focus specs and the Popover and Dialog interaction specs pass in Chromium, 59: verified.
- Description, the two unit cases fail on main and pass here, as the browser spec does: verified.
- Description, type check, formatting and knowledge checks are clean: verified.
- Description, writing rubric (present tense, the verification row names test files only, no narration, references or status): verified.
- Description, scope names no component directly: verified (no public API change).
- Description, owner and land path: a process plan, nothing in the code to check; the pull request has since left draft.
- File
.changeset/close-keeps-focus-moving-elsewhere.md: clear. - File
docs/specs/AST-116-popover-anchoring/spec.md: non-blocking (the new sentence's main text reads wider than its parenthetical). - File
packages/core/src/DateInput/__tests__/DateInputSecondFieldFocus.interaction.browser.spec.ts: non-blocking (the header counts four fields, the story has five). - File
packages/core/src/utils/focusReturn.ts: clear. - File
packages/core/src/utils/layerFocusReturn.test.tsx: clear.


















Primary intent
Bug fix: a popover, dialog or menu that closes while focus moves from inside it to another control no longer pulls focus back to its opener. A move that starts outside the layer is not affected: there the focus already left the layer before the close.
Fixes #13518, reported by @duytbp with a reproduction and an event trace.
User impact
Cause
DateInput closes its calendar from the field's
focusout, while focus is moving to the pressed field. During that event nothing is focused yet, so the shared focus return (utils/focusReturn.ts) read focus as stranded and focused the opener, which cancelled the browser's move.Change
utils/focusReturn.ts: each open layer record notes the control outside the layer that focus is moving to, from a capture-phaseblur(it reaches the document before the element's ownblurandfocusoutlisteners) to the nextfocusin; a target that cannot take focus clears the note after one task.isLayerFocusStrandedtreats that move as focus outside the layer, so the close leaves focus to that control. Every overlay that uses the shared return gets this.spec:AST-116FR17 names that case: focus moving to a control outside the layer when the layer closes stays with that control. The verification row names the new tests.DateInputSecondFieldFocus.interaction.browser.spec.ts(Chromium): a focused grid day, a press on another field, focus and typed text in that field; and the Escape control.layerFocusReturn.test.tsx: a close during a move, from afocusoutor a nativeblurlistener, never focuses the opener and leaves focus at the target (both fail on main); a close with no target still returns focus.[fix]patch.Authority
spec:AST-116FR17 (focus return acts only on stranded focus), amended here to name a close during a focus move. Specs to rule whether this is consistency or needs an owner decision.Evidence
core-dateinput--formats): "a press in another field from a focused grid day keeps focus in that field" fails on main (the second field is not focused) and passes here. The Escape control and the existingDateInputFocusLeavecases pass on both.tscis clean; prettier is clean;check:knowledgeis aligned.Writing rubric results
Scope
Components: none directly (the shared layer focus return).
Owner and land path