Repository navigation
fix(Selector, MultiSelector): a pick, or a press on a container that is no Tab stop, returns focus to the trigger - #11851
Conversation
A Selector and a MultiSelector inside a container with tabIndex -1: a pick in the list, or a press on the container, moves focus to the container before the list closes. The tests expect the close to return focus to the trigger, and a press on another field in the same container to keep focus there. Stories put each one and a Notes field in such a container. Browser specs drive them with a mouse, a finger and the keyboard in both engines.
A light dismiss keeps focus on the element a press moved it to, so a press on another field leaves focus in that field. A press inside the list, or on a focusable container around it, moves the browser's focus to that container, such as a dialog's content box with tabIndex -1. The close then left focus on the container, and keyboard and screen-reader users lost their place after a pick. A container of the list is no other control, so focus on it would otherwise be lost. The close now returns it to the trigger.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Selector | 113.2 kB (+297 B) · 18.7 kB CSS (0) | — | ✗ · ✓ · ✓ |
| LayerProvider | 4.4 kB (0) · 20 B CSS (0) | — | ✓ · ✓ · ✗ |
| SelectorOption | 24.0 kB (0) · 6.7 kB CSS (0) | — | ✗ · ✓ · ✓ |
116 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| MultiSelector · Storybook | 101.8 kB (+269 B) · 17.8 kB CSS (0) | 2,719 (0) | ✓ · ✓ · ✓ |
| Pagination | 124.2 kB (+259 B) · 19.1 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 300.0 kB (+236 B) · 454 B CSS (0) | — | — · — · — |
| PowerSearch | 307.1 kB (+143 B) · 25.6 kB CSS (0) | — | — · — · — |
| DateRangeInput | 99.4 kB (+33 B) · 13.3 kB CSS (0) | — | — · — · — |
| Popover | 98.8 kB (+31 B) · 15.2 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 114.9 kB (+30 B) · 1.1 kB CSS (0) | — | — · — · — |
| Typeahead | 88.0 kB (+29 B) · 13.5 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 174.1 kB (+28 B) · 1.9 kB CSS (0) | — | — · — · — |
| DropdownMenu | 107.5 kB (+27 B) · 18.9 kB CSS (0) | — | — · — · — |
| MoreMenu | 107.8 kB (+27 B) · 18.9 kB CSS (0) | — | — · — · — |
| ChatComposer | 84.7 kB (+26 B) · 12.9 kB CSS (0) | — | — · — · — |
| DateInput | 200.2 kB (+25 B) · 18.0 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 363.6 kB (+21 B) · 2.4 kB CSS (0) | — | — · — · — |
| DateTimeInput | 223.7 kB (+20 B) · 19.8 kB CSS (0) | — | — · — · — |
| SideNavHeading | 82.6 kB (+20 B) · 12.1 kB CSS (0) | — | — · — · — |
| lab/Comments | 370.4 kB (+20 B) · 2.5 kB CSS (0) | — | — · — · — |
| SideNavItem | 77.1 kB (+19 B) · 11.9 kB CSS (0) | — | — · — · — |
| BaseTypeahead | 78.5 kB (+18 B) · 11.7 kB CSS (0) | — | — · — · — |
| Tokenizer | 104.4 kB (+17 B) · 20.4 kB CSS (0) | — | — · — · — |
| ComplexSelector | 77.7 kB (+16 B) · 12.7 kB CSS (0) | — | — · — · — |
| TopNavHeading | 82.2 kB (+16 B) · 12.0 kB CSS (0) | — | — · — · — |
| ChatComposerInput | 82.3 kB (+15 B) · 12.1 kB CSS (0) | — | — · — · — |
| ChatComposerTokenElement | 82.3 kB (+15 B) · 12.1 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 97.0 kB (+14 B) · 13.3 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 76.2 kB (+14 B) · 12.7 kB CSS (0) | — | — · — · — |
| TopNavMenu | 81.6 kB (+13 B) · 12.0 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 113.8 kB (+13 B) · 773 B CSS (0) | — | — · — · — |
| TabMenu | 79.0 kB (+12 B) · 11.9 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 121.2 kB (+1 B) · 1.4 kB CSS (0) | — | — · — · — |
| charts/Chart | 238.4 kB (0) · 516 B CSS (0) | — | — · — · — |
| charts/ChartLegend | 40.3 kB (0) · 224 B CSS (0) | — | — · — · — |
| charts/ChartTooltip | 215.5 kB (0) · 451 B CSS (0) | — | — · — · — |
| AlertDialog | 128.8 kB (0) · 15.5 kB CSS (0) | — | — · — · — |
| AppShell | 97.7 kB (0) · 14.4 kB CSS (0) | — | — · — · — |
| Avatar | 46.0 kB (0) · 5.7 kB CSS (0) | — | — · — · — |
| AvatarGroup | 48.8 kB (0) · 5.8 kB CSS (0) | — | — · — · — |
| AvatarGroupOverflow | 52.0 kB (0) · 5.7 kB CSS (0) | — | — · — · — |
| Banner | 67.1 kB (0) · 11.3 kB CSS (0) | — | — · — · — |
| Button | 65.0 kB (0) · 10.8 kB CSS (0) | — | — · — · — |
| Calendar | 76.1 kB (0) · 11.4 kB CSS (0) | — | — · — · — |
| Carousel | 74.8 kB (0) · 11.7 kB CSS (0) | — | — · — · — |
| ChatDictationButton | 65.6 kB (0) · 10.9 kB CSS (0) | — | — · — · — |
| ChatLayout | 88.3 kB (0) · 11.4 kB CSS (0) | — | — · — · — |
| ChatLayoutScrollButton | 65.6 kB (0) · 11.0 kB CSS (0) | — | — · — · — |
| ChatMessageList | 27.4 kB (0) · 7.1 kB CSS (0) | — | — · — · — |
| ChatSendButton | 65.5 kB (0) · 10.8 kB CSS (0) | — | — · — · — |
| ChatToolCalls | 31.6 kB (0) · 8.5 kB CSS (0) | — | — · — · — |
| CheckboxInput | 69.1 kB (0) · 10.2 kB CSS (0) | — | — · — · — |
| CheckboxList | 73.2 kB (0) · 7.8 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 80.0 kB (0) · 12.1 kB CSS (0) | — | — · — · — |
| CodeBlock | 80.5 kB (0) · 12.1 kB CSS (0) | — | — · — · — |
| CommandPalette | 78.0 kB (0) · 12.8 kB CSS (0) | — | — · — · — |
| CommandPaletteInput | 32.9 kB (0) · 7.6 kB CSS (0) | — | — · — · — |
| ContextMenu | 102.1 kB (0) · 18.8 kB CSS (0) | — | — · — · — |
| Dialog | 25.6 kB (0) · 7.0 kB CSS (0) | — | — · — · — |
| DialogHeader | 68.0 kB (0) · 12.4 kB CSS (0) | — | — · — · — |
| DrawerHeader | 68.1 kB (0) · 13.8 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 78.5 kB (0) · 10.5 kB CSS (0) | — | — · — · — |
| Field | 59.5 kB (0) · 7.3 kB CSS (0) | — | — · — · — |
| FieldLabel | 55.4 kB (0) · 5.8 kB CSS (0) | — | — · — · — |
| FileInput | 74.2 kB (0) · 11.7 kB CSS (0) | — | — · — · — |
| Heading | 11.6 kB (0) · 5.5 kB CSS (0) | — | — · — · — |
| HoverCard | 30.3 kB (0) · 4.5 kB CSS (0) | — | — · — · — |
| IconButton | 65.1 kB (0) · 10.8 kB CSS (0) | — | — · — · — |
| InfoTip | 50.5 kB (0) · 5.4 kB CSS (0) | — | — · — · — |
| InputGroup | 61.1 kB (0) · 7.9 kB CSS (0) | — | — · — · — |
| Lightbox | 146.0 kB (0) · 12.0 kB CSS (0) | — | — · — · — |
| Link | 56.4 kB (0) · 7.1 kB CSS (0) | — | — · — · — |
| ListItem | 79.1 kB (0) · 12.1 kB CSS (0) | — | — · — · — |
| Markdown | 203.1 kB (0) · 22.0 kB CSS (0) | — | — · — · — |
| MobileNav | 76.3 kB (0) · 11.4 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 65.4 kB (0) · 10.8 kB CSS (0) | — | — · — · — |
| NumberInput | 77.6 kB (0) · 12.2 kB CSS (0) | — | — · — · — |
| ProgressBar | 11.9 kB (0) · 6.4 kB CSS (0) | — | — · — · — |
| RadioList | 60.8 kB (0) · 7.4 kB CSS (0) | — | — · — · — |
| RadioListItem | 76.1 kB (0) · 10.7 kB CSS (0) | — | — · — · — |
| SegmentedControl | 102.2 kB (0) · 6.9 kB CSS (0) | — | — · — · — |
| SideNav | 121.3 kB (0) · 12.2 kB CSS (0) | — | — · — · — |
| SideNavCollapseButton | 65.9 kB (0) · 10.8 kB CSS (0) | — | — · — · — |
| Slider | 114.5 kB (0) · 8.9 kB CSS (0) | — | — · — · — |
| Spinner | 24.0 kB (0) · 6.3 kB CSS (0) | — | — · — · — |
| StatusDot | 33.9 kB (0) · 5.4 kB CSS (0) | — | — · — · — |
| Stepper | 66.8 kB (0) · 10.9 kB CSS (0) | — | — · — · — |
| Switch | 109.0 kB (0) · 10.0 kB CSS (0) | — | — · — · — |
| Table | 120.3 kB (0) · 19.7 kB CSS (0) | — | — · — · — |
| TableCell | 103.3 kB (0) · 19.2 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 103.0 kB (0) · 19.0 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 75.4 kB (0) · 14.1 kB CSS (0) | — | — · — · — |
| Text | 11.0 kB (0) · 5.5 kB CSS (0) | — | — · — · — |
| TextArea | 66.9 kB (0) · 9.4 kB CSS (0) | — | — · — · — |
| TextInput | 72.8 kB (0) · 12.0 kB CSS (0) | — | — · — · — |
| Thumbnail | 69.4 kB (0) · 12.4 kB CSS (0) | — | — · — · — |
| TimeInput | 175.0 kB (0) · 17.0 kB CSS (0) | — | — · — · — |
| Timer | 13.1 kB (0) · 6.1 kB CSS (0) | — | — · — · — |
| Timestamp | 27.0 kB (0) · 11.1 kB CSS (0) | — | — · — · — |
| Toast | 103.7 kB (0) · 11.1 kB CSS (0) | — | — · — · — |
| ToggleButton | 92.1 kB (0) · 10.9 kB CSS (0) | — | — · — · — |
| Tooltip | 32.2 kB (0) · 4.5 kB CSS (0) | — | — · — · — |
| TopNav | 78.1 kB (0) · 11.8 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 60.4 kB (0) · 1.2 kB CSS (0) | — | — · — · — |
| lab/DialogHeroHeader | 88.8 kB (0) · 372 B CSS (0) | — | — · — · — |
| lab/DiffViewer | 93.2 kB (0) · 2.1 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 92.5 kB (0) · 751 B CSS (0) | — | — · — · — |
| lab/LineClamp | 13.5 kB (0) · 168 B CSS (0) | — | — · — · — |
| lab/ListInput | 93.6 kB (0) · 922 B CSS (0) | — | — · — · — |
| lab/Schedule | 114.7 kB (0) · 3.9 kB CSS (0) | — | — · — · — |
| lab/SelectableCardGroup | 68.9 kB (0) · 162 B CSS (0) | — | — · — · — |
| lab/TabBarMoreList | 102.0 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| lab/TourStep | 93.4 kB (0) · 691 B CSS (0) | — | — · — · — |
| lab/TransferList | 112.2 kB (0) · 1.2 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 305.9 kB (0) · 2.6 kB CSS (0) | — | — · — · — |
| richtext/RichTextView | 282.5 kB (0) · 2.3 kB CSS (0) | — | — · — · — |
| Drawer | 54.2 kB (−1 B) · 8.5 kB CSS (0) | — | — · — · — |
| layer | — | — | — · ✓ · — |
| Layer | — | — | ✓ · ✓ · — |
Visual changes: 4 snapshots in 1 component
A change is a question for the reviewer, not a failure.
Inheritance checked against the 5 newest reports of other pull requests.
Package size: @astryxdesign/core 7.62 MB packed (+1.1 kB); no new dependencies.
Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
|
/approve-spec 5ef8192 |
There was a problem hiding this comment.
Changes requested for one release-note fix; the focus fix itself is correct and covered by tests.
- The changeset says a pick returns focus to the trigger in both components, but a MultiSelector pick keeps focus on the container until the list closes, and a finger pick in a Selector already returned focus before this change, so please reword it, for example: "after a mouse pick in a Selector, when a MultiSelector closes after a pick, or after a press on a focusable container around the list, focus returns to the trigger again."
The code change restores the components' focus-return rule, and the new unit cases and browser specs fail before the fix and pass after it. CI has not run on this draft head yet.
Claims and files checked
Review mode: full; reason: no-earlier-review
- A Selector pick or a press on a focusable container around the list returns focus to the trigger: verified for mouse picks and container presses (unit and browser tests).
- The same for MultiSelector picks: false as worded; focus returns when the list closes, not at the pick.
- Before the fix the press left focus on the container: verified for mouse picks and container presses; a finger pick in a Selector already kept focus on the trigger.
- A press on another field still leaves focus there: verified.
- The earlier fix that keeps focus on another field shipped in 0.7.6, and 0.7.5 always returned focus: verified in history and the changelog.
- One added condition in the shared presentation hook, with no public API, prop, default or visual change: verified, including a built API surface comparison.
- 7 of 13 browser cases fail before the fix and all 13 pass after: verified in Chromium; WebKit not run in this review.
- Four new unit cases fail before the fix and pass after: verified.
- Size +521/−6 with the stated split: verified; per-component gzip figures not measured in this review.
- The four reference pages do not change size: consistent with the import graph, since none of them reaches the Selector.
- Files: the presentation hook, both unit test files, both browser specs and both stories are clear; the changeset has the finding above.
A container that is a Tab stop, such as a card with tabIndex 0, takes focus from a press on its padding. That press is a light dismiss onto a focusable target, so the tests expect focus to stay on the container. A pick inside such a container still returns focus to the trigger. Each component gets a story with a tabIndex 0 container, and the unit and browser specs cover a mouse and a finger. The browser specs now wait for the close to finish before they check where focus is: the close returns focus in the popover's toggle handler, a task after the list hides, so a check that focus stayed put could pass too soon.
The close now tells a press inside the list from a press outside it. While the list is open, a capture listener notes whether the last press landed inside the list. After a press inside the list, such as a pick, focus returns to the trigger, whatever container the list sits in. After a press outside the list, focus stays where the press put it only on a Tab stop, such as another field or a card with tabIndex 0. A press that lands on no Tab stop returns focus to the trigger.
Focus returns after a mouse pick in a Selector, when a MultiSelector closes after a pick, and after a press that lands on no Tab stop. A finger pick in a Selector kept focus on the trigger already, and a press outside the list still keeps a Tab stop it lands on.
With focus on the search field inside the open list, a keyboard pick in a Selector, or a pick and Escape in a MultiSelector, closes the list. Focus returns to the trigger, since the search field sits inside the list that closes.
Roving groups, such as tabs and segmented controls, give every item but the current one tabIndex -1. A mouse press on such an item while the list is open focuses it before the list closes. The tests expect focus to stay on it, as after a light dismiss onto another control. Each story gains a Next tab button with tabIndex -1 beside the Selector, and the unit and browser specs press it.
The close tested every element an outside press focused for a Tab stop. So a pressed tab in a roving group, with tabIndex -1, lost its focus to the trigger. Now only an element that contains the list is tested. A container with tabIndex -1, such as a dialog's content box, gives focus back to the trigger, and one with tabIndex 0 keeps it. Any other element that a press outside the list focuses keeps it.
|
/approve-spec 2b441f2 |
There was a problem hiding this comment.
Changes requested: the focus fix behaves as described and an engineering owner approved its reading for this head, but the press tracking should go through the shared outside-press watch, and two claims need correcting.
useSelectorPresentation.tsadds its own documentpointerdownlistener and an unmount Effect to tell a press inside the list from one outside it, beside the shared watch inLayer/outsidePress.tsthat the list's layer already runs, so please letuseOutsidePressreport each press's inside judgment, call it once from the hook, and drop the hand-rolled listener and Effect.- The title says focus on the list's container returns to the trigger, but a press on a container that is a Tab stop keeps focus there, so please narrow it, for example to "a pick, or a press on a container that is no Tab stop, returns focus to the trigger".
- The description says four new unit cases fail against main, but six of the fourteen do (the pick inside a Tab-stop container fails too, for each component), so please update the count.
The earlier release-note wording is fixed, and all 25 browser cases pass in Chromium at this head. CI has not run on this draft head yet.
Claims and files checked
Review mode: full; reason: over-500-lines
- Changeset: a Selector mouse pick returns focus to the trigger: verified (unit case and browser spec fail before the fix and pass after).
- Changeset: a MultiSelector returns focus when it closes after a pick: verified.
- Changeset: a press on a container around the list that is no Tab stop returns focus: verified.
- Changeset: before, focus stayed on such a container and keyboard users lost their place: verified in Chromium, where the next arrow key went nowhere; the screen-reader effect is inferred.
- Changeset: a press on another field, an unselected tab or a Tab-stop container keeps focus where it lands: verified.
- Description: the overlay-dismissal record names a browser focusing a focusable ancestor of the pressed element: verified, in its sentence about the return target.
- Description: each component owns its return target, the trigger: verified.
- Description: the earlier fix that keeps focus on another field shipped in 0.7.6, and 0.7.5 returned focus after a pick: verified in the changelog.
- Description: the restoration rules (press tracking, return after a press inside the list or on a non-Tab-stop container, other focus kept): verified in the hook.
- Description: no record, public API, prop, default or visual change: verified, including a built API surface comparison.
- Description: all 25 browser cases pass at this head: verified in Chromium; WebKit not run in this review.
- Description: the first test commit fails 7 of 13 browser cases: not repeated in this review.
- Description: four new unit cases fail against main: false; six fail.
- Description: two Tab-stop cases fail against the first fix's rule, and two roving-item cases against the second: verified.
- Description: a finger pick in a Selector never moved focus to the container on main: not reproduced in this review.
- Description: the unit suites pass: verified for Selector, MultiSelector and Popover (569 tests).
- Description: build and typecheck pass: the Core build, which type-checks its source, passes; the full typecheck was not run.
- Description: lint, knowledge and changeset checks pass: not run in this review.
- Description: size +986/−7 with the stated split: verified.
- Description: per-component gzip figures: not measured; the four reference pages do not reach the changed hook, so their 0 B holds.
- Title: focus on the list's container returns to the trigger: broader than the change, since a Tab-stop container keeps focus.
- Files:
useSelectorPresentation.tshas the shared-path finding and one comment suggestion;Selector.test.tsx,MultiSelector.test.tsx, both browser specs, both story files and the changeset are clear.
A Selector inside a shadow root renders its list there too. A document listener sees a press inside that root on the root's host, so a judgment by event.target counts a pick as a press outside the list. The test expects focus back on the trigger after such a pick.
The close told a press inside the list from one outside by the press's event.target. A document listener sees a press inside an open shadow root on the root's host, so a pick there counted as a press outside the list, and focus stayed on a container around it. The listener now looks for the list in the press's composed path.
|
/approve-spec 0ff9fda |
There was a problem hiding this comment.
Changes requested: the focus fix behaves as described and an engineering owner approved its reading for this head, but the press tracking still needs to go through the shared outside-press watch, and one description line needs a fix.
useSelectorPresentation.tskeeps its own documentpointerdownlistener and unmount Effect to tell a press inside the list from one outside it, beside theLayer/outsidePress.tswatch the list's layer already runs, whicharchitecture:react-component-runtimeINV16 rules out; your measuredonPressshape shows the shared watch can serve this case, and it would also bring the closed-shadow-root handling this listener lacks, so please extend the shared watch, call it once with the list's shadow root, and drop the listener and its Effect.- The description says Testing names each red case, but it leaves out the pick inside a Tab-stop container, which fails against main for each component, so please name those two cases or drop the sentence.
The rest holds: 7 of the 15 new unit cases fail against main and all pass here. CI has not run on this draft head yet.
Claims and files checked
Review mode: same-head; reason: none
- Changeset: a Selector mouse pick returns focus to the trigger: verified (unit case fails on main, passes here; Chromium capture).
- Changeset: a MultiSelector that closes after a pick returns focus to the trigger: verified (unit case fails on main, passes here).
- Changeset: a press on a container around the list that is no Tab stop returns focus: verified (unit cases for both components).
- Changeset: before, focus stayed on such a container and keyboard users lost their place: verified in unit cases and Chromium; the screen-reader effect is inferred.
- Changeset: a press on another field, an unselected tab or a Tab-stop container keeps focus where it lands: verified (unit cases pass on main and here).
- Description: inside a focusable container a pick, or a press on its padding, left focus there: verified for the mouse; the description itself notes a Selector finger pick never moved focus.
- Description: the overlay-dismissal record names a browser focusing a focusable ancestor of the pressed control: verified, in its return-target sentence.
- Description: each component owns its return target, the trigger: verified.
- Description: the fix that keeps focus on another field shipped in 0.7.6, and 0.7.5 returned focus after a pick: verified in the changelog.
- Description: the restoration rules (press judged on its composed path, return after a press inside the list or on a container that is no Tab stop, other focus kept): verified in the hook.
- Description: a follow-up covers a pick in a closed shadow root and a container press in any root: consistent; a probe confirms the closed-root pick still leaves focus on the container.
- Description: no record, public API, prop, default or visual change: verified, including a built API surface comparison.
- Description: a press on another field keeps focus and Escape still returns it: verified (unit cases).
- Description: seven of the fifteen new unit cases fail against main: verified.
- Description: Testing names each red case: false; the two Tab-stop pick cases are not named.
- Description: 25 browser cases pass in Chromium and WebKit, earlier commits fail the named browser cases, and a Selector finger pick never focused the container on main: not re-run in this review.
- Description: unit tests, build, typecheck, lint, Prettier and changeset checks pass: verified for the Selector, MultiSelector and Popover tests (640), lint and Prettier on the changed files, the core typecheck and the changeset check.
- Description: size +1,021/−7 with its split, and 0 B on the four reference pages: line counts verified; gzip sizes not re-measured.
packages/core/src/Selector/useSelectorPresentation.ts: shared press watch finding.packages/core/src/Selector/Selector.test.tsx: clear.packages/core/src/MultiSelector/MultiSelector.test.tsx: clear.packages/core/src/Selector/__tests__/SelectorFocusableContainer.a11y.browser.spec.ts: clear (read, not run).packages/core/src/MultiSelector/__tests__/MultiSelectorFocusableContainer.a11y.browser.spec.ts: clear (read, not run).apps/storybook/stories/Selector.stories.tsx: clear.apps/storybook/stories/MultiSelector.stories.tsx: clear..changeset/selector-pick-focus-container.md: clear.
A document listener's composed path leaves out the nodes inside a closed shadow root. So a pick from a list there reads as a press outside the list, and focus stays on a container around it. The test expects focus back on the trigger after such a pick.
The close told a press inside the list from one outside with its own document listener. Its composed path leaves out a closed shadow root, so a pick there read as a press outside, and it repeated the outside- press watch the layer runtime owns. The shared watch gains onPress: it reports where each press begins, judged in the document and in each shadow root around the list, and closes nothing. The hook starts it on show and stops it on hide, and useOutsidePress stops it on unmount. The listener and its Effect go.
|
/approve-spec 896c43c |
|
/approve-spec 4579263 |
There was a problem hiding this comment.
Approved pending CI: CI's run on this head stopped at admission because CI was full, so its required checks have not run yet; re-running all jobs, or the next push, runs them.
The only change since the last review merges main: the pull request's own patch is unchanged, and none of its files changed on main. On this head the Selector, MultiSelector, Layer and Popover unit suites, Core's typecheck, strict ESLint and Prettier on the changed files, and the changeset and lint-baseline checks pass, and an engineering owner approved the focus reading for this head.
Claims and files checked
Review mode: carry-forward; reason: none
- Changeset: a Selector mouse pick returns focus to the trigger again: verified (a unit case fails on the base close and passes here; a Chromium probe on this same patch).
- Changeset: a MultiSelector that closes after a pick returns focus to the trigger: verified (unit case; Chromium probe of a pick and Escape on this same patch).
- Changeset: a press on a container around the list that is no Tab stop returns focus: verified (unit cases for both components; Chromium probe of a padding press).
- Changeset: before, focus stayed on such a container, so keyboard and screen-reader users lost their place: verified for focus placement (red-first unit cases and base probes); the screen-reader effect is inferred.
- Changeset: a press on another field, an unselected tab or a Tab-stop container leaves focus where it lands: verified (unit cases pass here; Chromium frames of the Tab-stop and field presses are pixel-identical on base and head).
- Title: a pick, or a press on a container that is no Tab stop, returns focus to the trigger: verified.
- Description: inside a focusable container a pick, or a press on its padding, left focus there, because the browser focuses the nearest focusable ancestor and the close kept it: verified (the base close and base probes).
- Description: the overlay-dismissal record names a browser focusing a focusable ancestor, and each component's return target is its trigger: verified (FR9 and AV1).
- Description: the fix that keeps focus on another field shipped in 0.7.6, and before it a pick returned focus: verified (Core changelog, 0.7.6 entry).
- Description: the shared watch reports where each press begins, in the document and in each shadow root, and closes nothing: verified (
outsidePress.ts:131,:166; two unit cases that fail on the base). - Description: after a press inside the list focus returns while the focused element still holds the list: verified (
useSelectorPresentation.ts:135-139; the key-move unit case). - Description: a press on a container returns focus only if it is no Tab stop, and any other element a press focuses keeps focus: verified (
useSelectorPresentation.ts:147; unit cases; Chromium probes). - Description: a follow-up covers a container press inside a shadow root: consistent; the close reads the page's focused element (
useSelectorPresentation.ts:131). - Description: no record, public API, prop, default or visual change: verified (no record or export changes; the API surface generator finds no row in Core or the themes for this patch; frames differ only in where focus sits).
- Description: the browser specs fail at the commits that add them, and a finger pick never focused the container on main: not re-run at those commits or on main.
- Description: 25 browser cases pass in Chromium and WebKit at an earlier commit: not re-run this time (25 of 25 passed in Chromium on this same patch at an earlier review); WebKit not run.
- Description: eight of the seventeen new unit cases fail against main's close, as Testing names them: verified on this same patch (red-first: exactly those eight, plus the two new watch cases).
- Description: the named failures at earlier commits (Tab-stop container, unselected tab, open and closed shadow-root picks, a key move after a pick): not re-run at those commits; each case exists and passes here.
- Description: the specs wait for the close to finish before they check focus: verified (the
watchClosehelper in both specs). - Description: unit tests for the components, Popover, Layer, the hooks and the watch's other users pass: partly verified (1,481 tests over Selector, MultiSelector, Layer and Popover pass here; the hooks and the other watch users were not re-run).
- Description: the pull request's accessibility specs pass in Chromium: not re-run.
- Description: build and typecheck pass: Core's typecheck verified here; the build was verified on this same patch at the last review.
- Description: strict ESLint, Prettier, the knowledge check and the changeset check pass: verified here for strict ESLint, Prettier and the changeset check; the knowledge check was not run (no record changed).
- Description: the lint baseline commit only drops two citations and its check passes: verified (baseline check reports up to date here).
- Description: earlier merges of
mainleft the pull request's own lines unchanged, with the option highlighted state, the focus trap change and the recorded Node test times they brought: verified at earlier reviews; the claims are unchanged. - Description: this head merges
mainwith the pull request's own lines unchanged: verified (identical patch; clean merge;mainchanged none of its files). - Description: that
maingives the popover hook's internal options an optional pending-open callback, which the Selector does not pass, and changes the theme definer: verified (the callback is added to the popover and layer hooks and runs only when passed; no Selector or MultiSelector file passes it; two theme-definer fixes are in the merge). - Description: on this head the anchor-readiness spec and both new specs pass in each engine: not re-run (no browser specs run for a merge that leaves the patch unchanged).
- Description: on this head the Selector, MultiSelector, Layer and Popover unit tests pass (1,481), with Core's and Storybook's typecheck: verified for the 1,481 tests and Core's typecheck; Storybook's typecheck was not run.
- Description: on this head strict ESLint on the changed files and the comment-provenance check pass: verified.
- Description: size +1,183/−11 against
mainwith its split (source +65/−8, tests +1,012/−1, stories +99, changeset +7, baseline −2): verified. - Description: per-import and reference-page gzip sizes, measured at an earlier commit, and CSS unchanged: CSS verified; the sizes were not re-measured (the patch is unchanged since they were measured).
packages/core/src/Selector/useSelectorPresentation.ts: clear.packages/core/src/Layer/outsidePress.ts: clear, with one non-blocking note (the internalonPressoption sits outside the title's Selector, MultiSelector scope).internal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clear (regenerated; the baseline check passes).packages/core/src/Layer/outsidePress.test.ts: clear.packages/core/src/Selector/Selector.test.tsx: clear.packages/core/src/MultiSelector/MultiSelector.test.tsx: clear.packages/core/src/Selector/__tests__/SelectorFocusableContainer.a11y.browser.spec.ts: clear.packages/core/src/MultiSelector/__tests__/MultiSelectorFocusableContainer.a11y.browser.spec.ts: clear.apps/storybook/stories/Selector.stories.tsx: clear.apps/storybook/stories/MultiSelector.stories.tsx: clear..changeset/selector-pick-focus-container.md: clear.
|
/approve-spec e5d1ab5 |
There was a problem hiding this comment.
Approved pending CI: this head is a draft, so CI skipped it, and its required checks run once the pull request is marked ready for review.
The only change since the last review merges main: the pull request's own patch is unchanged, and none of its files changed on main. On this head the Selector, MultiSelector, Layer, Popover and Dialog unit suites (1,640 tests), Core's typecheck, strict ESLint and Prettier on the changed files, and the changeset, knowledge and lint-baseline checks pass, and an engineering owner approved the focus reading for this head.
Claims and files checked
Review mode: carry-forward; reason: none
- Changeset: a Selector mouse pick returns focus to the trigger again: verified (a unit case fails on the base close and passes here; a Chromium probe on this same patch).
- Changeset: a MultiSelector that closes after a pick returns focus to the trigger: verified (unit case; Chromium probe of a pick and Escape on this same patch).
- Changeset: a press on a container around the list that is no Tab stop returns focus: verified (unit cases for both components; Chromium probe of a padding press).
- Changeset: before, focus stayed on such a container, so keyboard and screen-reader users lost their place: verified for focus placement (red-first unit cases and base probes); the screen-reader effect is inferred.
- Changeset: a press on another field, an unselected tab or a Tab-stop container leaves focus where it lands: verified (unit cases pass here; Chromium frames of the Tab-stop and field presses are pixel-identical on base and head).
- Title: a pick, or a press on a container that is no Tab stop, returns focus to the trigger: verified.
- Description: inside a focusable container a pick, or a press on its padding, left focus there, because the browser focuses the nearest focusable ancestor and the close kept it: verified (the base close and base probes).
- Description: the overlay-dismissal record names a browser focusing a focusable ancestor, and each component's return target is its trigger: verified (FR9 and AV1).
- Description: the fix that keeps focus on another field shipped in 0.7.6, and before it a pick returned focus: verified (Core changelog, 0.7.6 entry).
- Description: the shared watch reports where each press begins, in the document and in each shadow root, and closes nothing: verified (
outsidePress.ts:131,:166; two unit cases that fail on the base). - Description: after a press inside the list focus returns while the focused element still holds the list: verified (
useSelectorPresentation.ts:135-139; the key-move unit case). - Description: a press on a container returns focus only if it is no Tab stop, and any other element a press focuses keeps focus: verified (
useSelectorPresentation.ts:147; unit cases; Chromium probes). - Description: a follow-up covers a container press inside a shadow root: consistent; the close reads the page's focused element (
useSelectorPresentation.ts:131). - Description: no record, public API, prop, default or visual change: verified (no record or export changes; the API surface generator finds no row in Core or the themes for this patch; frames differ only in where focus sits).
- Description: the browser specs fail at the commits that add them, and a finger pick never focused the container on main: not re-run at those commits or on main.
- Description: 25 browser cases pass in Chromium and WebKit at an earlier commit: not re-run (25 of 25 passed in Chromium on this same patch at an earlier review); WebKit not run.
- Description: eight of the seventeen new unit cases fail against main's close, as Testing names them: verified on this same patch (red-first: exactly those eight, plus the two new watch cases).
- Description: the named failures at earlier commits (Tab-stop container, unselected tab, open and closed shadow-root picks, a key move after a pick): not re-run at those commits; each case exists and passes here.
- Description: the specs wait for the close to finish before they check focus: verified (the
watchClosehelper in both specs). - Description: unit tests for the components, Popover, Layer, the hooks and the watch's other users pass: partly verified (1,640 tests over Selector, MultiSelector, Layer, Popover and Dialog pass here; the hooks and the other watch users were not re-run).
- Description: the pull request's accessibility specs pass in Chromium: not re-run.
- Description: build and typecheck pass: Core's typecheck verified here; the build was verified on this same patch at an earlier review.
- Description: strict ESLint, Prettier, the knowledge check and the changeset check pass: verified here.
- Description: the lint baseline commit only drops two citations and its check passes: verified (baseline check reports up to date here).
- Description: earlier merges of
mainleft the pull request's own lines unchanged, with the option highlighted state, the focus trap change, the recorded Node test times, the popover's optional pending-open callback and the theme definer changes they brought: verified at earlier reviews; the claims are unchanged. - Description: this head merges
mainwith the pull request's own lines unchanged: verified (identical patch; clean merge;mainchanged none of its files). - Description: that
mainmakes a dialog's text read the theme and admits a release-critical pull request to CI at once: verified (both changes are in the merged range). - Description: on this head the anchor-readiness spec and both new specs pass in each engine: not re-run (no browser specs run for a merge that leaves the patch unchanged).
- Description: on this head the Selector, MultiSelector, Layer, Popover and Dialog unit tests pass (1,640), with Core's and Storybook's typecheck: verified for the 1,640 tests and Core's typecheck; Storybook's typecheck could not be checked here, since it needs the sibling packages built.
- Description: on this head the release-spec plan test, strict ESLint on the changed files and the comment-provenance check pass: verified for strict ESLint and the comment-provenance check; the release-spec plan test could not run here, since it reads the repository's git file list.
- Description: size +1,183/−11 against
mainwith its split (source +65/−8, tests +1,012/−1, stories +99, changeset +7, baseline −2): verified. - Description: per-import and reference-page gzip sizes, measured at an earlier commit, and CSS unchanged: CSS verified; the sizes were not re-measured (the patch is unchanged since they were measured).
packages/core/src/Selector/useSelectorPresentation.ts: clear.packages/core/src/Layer/outsidePress.ts: clear, with one non-blocking note (the internalonPressoption sits outside the title's Selector, MultiSelector scope).internal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clear (regenerated; the baseline check passes).packages/core/src/Layer/outsidePress.test.ts: clear.packages/core/src/Selector/Selector.test.tsx: clear.packages/core/src/MultiSelector/MultiSelector.test.tsx: clear.packages/core/src/Selector/__tests__/SelectorFocusableContainer.a11y.browser.spec.ts: clear.packages/core/src/MultiSelector/__tests__/MultiSelectorFocusableContainer.a11y.browser.spec.ts: clear.apps/storybook/stories/Selector.stories.tsx: clear.apps/storybook/stories/MultiSelector.stories.tsx: clear..changeset/selector-pick-focus-container.md: clear.












User impact
Inside a container that takes focus but is no control, such as a dialog's content box, a Selector or MultiSelector pick left focus there. Keyboard and screen-reader users lost their place. A press on the container's padding did the same.
Problem and solution fit
Expected behavior and authority
family:overlay-dismissalFR9: closing returns focus, when it would otherwise be lost, to the member's return target. It names this trap: a browser may focus a focusable ancestor of the pressed element.family:overlay-dismissalAV1: each member owns its return target, and for both components that is the trigger.Smallest restoration
tabIndex={0}, keeps it.Evidence
Scope
Components: Selector, MultiSelector
Testing
Every run used 1 worker, at ff61434 unless it names another commit:
SelectorFocusableContainer.a11y.browser.spec.tsandMultiSelectorFocusableContainer.a11y.browser.spec.ts(new): 25 passed in Chromium and 25 in WebKit.tabIndex={-1}container, for both components, under a mouse and a finger.tabIndex={0}container failed in each engine. That held for both components and both inputs.tabIndex={-1}button, as an unselected tab is, failed in each engine. That held for both components and both inputs.tabIndex={-1}container, and a pick inside atabIndex={0}container.pnpm test:a11y-contract:pr): 277 passed in Chromium.pnpm build, thenpnpm typecheck: no errors.pnpm check:knowledgeandpnpm check:changesetspass.anchorReadiness.a11y.browser.spec.tsand both new specs pass, 36 cases in each engine. 4,723 unit tests,pnpm typecheckand the lint job's checks pass too.usePopover's internal options an optionalonOpenPendingChange(fix(DropdownMenu): a waiting open still takes focus and fires onClick #11905), which the Selector does not pass. It also changesdefineTheme(#11939,#11973).anchorReadiness.a11y.browser.spec.tsand both new specs pass, 36 cases in each engine. Selector, MultiSelector, Layer and Popover unit tests pass (1,481), with Core's and Storybook's typecheck. Strict ESLint on the changed files and the comment-provenance check pass too.#12095), and CI admits a release-critical pull request at once (ci: a release-critical pull request is admitted at once #12108).anchorReadiness.a11y.browser.spec.tsand both new specs pass, 36 cases in each engine. Selector, MultiSelector, Layer, Popover and Dialog unit tests pass (1,640), with Core's and Storybook's typecheck. The release-spec plan test, strict ESLint on the changed files and the comment-provenance check pass too.Public and internal API delta
None public. Internal: the shared outside-press watch (
Layer/outsidePress.ts) gainsonPress, which reports where each press begins and closes nothing.Size: +1,183/−11 lines (5c58206..e5d1ab5, against main): source +65/−8, tests +1,012/−1, stories +99, changeset +7, and the comment-provenance baseline −2.
Each size below is measured at ff61434 against main 30b12dd, as
.github/scripts/lib/component-size.jsmeasures an import:architecture:component-import-boundariesINV10 pages: docs, form, tableLayer/outsidePress.ts(+27 of +29 B minified)CSS does not change. Selector and MultiSelector grow most because
useOutsidePressis new to their bundles.