Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
|
Thanks for taking this on! On the head, with a coarse pointer, both A few things before it's ready, from the reporter's side:
With 1 to 3 addressed, the focus half would resolve #11963's main report; the keyboard-fit half |
|
@cixzhang Could you decide whether searchable Selector and MultiSelector touch sheets should adopt initial panel focus, with search taking focus only when the person enters it, and record that outcome in their owning contracts if accepted? At The proposed boundary is There is an existing sibling pattern: Tokenizer FR18 and PowerSearch FR13 explicitly put initial focus on the panel, not search. They motivate this choice but do not override Selector's own contract. The AS-IS/TO-BE recordings in the description use merge base |
|
@duytbp Thanks for checking this. I've added the spec changes in eb6dacf: searchable coarse-pointer sheets start on the panel, including adaptive sheets and MultiSelector's The AS-IS/TO-BE videos are in the description now. They use native Chromium with touch emulation and show the panel taking focus without search receiving a focus event on opening. They're not a real-phone keyboard test. I'm keeping the panel target, as Tokenizer and PowerSearch do. I haven't checked screen-reader announcements, so I can't claim it reads better than the heading. The shared |
There was a problem hiding this comment.
Thanks for the clear write-up and the before/after comparison. This can't be approved yet: opening touch sheets on the panel intentionally changes the current Selector AR2 and MultiSelector FR8 focus rules, so an engineering owner has to accept or reject the amended clauses by commenting /approve-spec <full head SHA> (you can do that yourself only if you are an engineering owner). Whatever that decision, these need changes:
- Typing on a searchable Selector's trigger on a touch device now keeps only the first character, because the sheet opens on the panel (
SelectorBottomSheet.tsx:71) while the trigger only seeds keys it still holds, which breaks Selector FR7's unchanged closed-trigger typeahead (in touch-emulated Chromium, typing "Ban" leaves "B"), so keep focusing search when a typed character opens the sheet. BottomSheet.doc.mjs(theheightandchildrendescriptions and the dense summary) andbrowser-support.doc.mjsstill say only a fully expanded Tall sheet handles the on-screen keyboard, which is no longer true for hug sheets.- The new verification rows in
Selector.spec.mdandMultiSelector.spec.mdcite "native-dialog browser focus checks" that are not committed, so add that browser check or drop the phrase. - The on-screen keyboard record (AST-099) requires iOS Simulator (Safari) and Android emulator (Chrome with Gboard) results at this head for a Selector search row in its hug sheet, stated in the description as device or emulator, browser, head, animation scale and result.
The branch also conflicts with main in useSelectorPresentation.ts and needs a rebase.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claims
- Changeset: searchable touch sheets stay on the panel until search is requested: false for typing on the trigger (
Selector.tsx:1426,SelectorBottomSheet.tsx:71; "Ban" becomes "B"). - Changeset: hug sheets fit above the on-screen keyboard: verified in jsdom (new
BottomSheet.test.tsxcase fails on the base, passes on the head); no simulator or emulator result. - Changeset: desktop popovers still focus search on open: verified (
Selector.tsx:1426,MultiSelector.tsx:1481). - Description: before, searchable sheets focus search on open, forced and adaptive: verified (new tests fail on the base; Chromium probe).
- Description: after, the panel takes focus with no search focus event, including on reopen: verified (
Selector.test.tsx,MultiSelector.test.tsx; Chromium probe). - Description: popovers, fine-pointer sheets and sheets without search keep their focus: verified (
Selector.tsx:1426,SelectorBottomSheet.tsx:74-76). - Description: the rule covers forced sheets, adaptive sheets and the caller-rendered trigger: verified (
useSelectorPresentation.ts:636;MultiSelector.test.tsx). - Description: the hug keyboard path also applies outside Selector: verified (
BottomSheetPanel.tsx:980-982). - Description: no public prop is added: verified (API surface generator, 0 rows).
- Description: search, selection, close and reopen still work: verified in jsdom (new tests).
- Description: the focused tests and the knowledge check pass: verified (1,388 tests across the four folders; knowledge check exit 0).
- Description rubric R3: verification entries name existing tests and native-dialog focus checks: false; no such check is committed.
- Description rubric R1 and R5: present tense, no pull request or issue references in the records: verified.
- Changeset: searchable touch sheets stay on the panel until search is requested: false for typing on the trigger (
- Files
.changeset/selector-touch-search.md: finding (typing on the trigger)docs/specs/components/MultiSelector/MultiSelector.spec.md: finding (owner decision; verification row)docs/specs/components/Selector/Selector.spec.md: finding (owner decision; verification row)packages/core/src/BottomSheet/BottomSheet.test.tsx: clearpackages/core/src/BottomSheet/BottomSheetPanel.tsx: finding (consumer docs not updated)packages/core/src/MultiSelector/MultiSelector.test.tsx: clearpackages/core/src/MultiSelector/MultiSelector.tsx: clearpackages/core/src/Selector/Selector.test.tsx: clearpackages/core/src/Selector/Selector.tsx: finding (typing on the trigger)packages/core/src/Selector/SelectorBottomSheet.tsx: finding (typing on the trigger)packages/core/src/Selector/useSelectorPresentation.ts: clear (conflicts withmain)packages/core/src/keyboard/README.md: clearpackages/core/src/keyboard/useMobileKeyboard.ts: clear in source; simulator and emulator results missing
eb6dacf to
d96cb11
Compare
There was a problem hiding this comment.
Thanks for taking the keyboard fit out of this change and for fixing typed opens. This can't be approved yet: opening touch sheets on the panel intentionally changes the current Selector AR2 and MultiSelector FR8 focus rules, so an engineering owner has to accept the amended clauses by commenting /approve-spec <full head SHA> (you can do that yourself only if you are an engineering owner) or say what keyboard-opened sheets should focus instead, since Enter on the trigger now also lands on the panel, where ArrowDown does nothing until Tab. Whatever that decision, this needs a change:
- The description still describes the earlier revision: it claims hug-height keyboard fitting, cites the on-screen keyboard record for it and lists BottomSheet and mobile keyboard handling, all of which the last commit removed, and its before/after evidence names a commit that is no longer on this branch, so please update it to match this head.
CI has not run on this head yet; a maintainer adds the ci:run label so it runs.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Claims
- Changeset: searchable touch sheets stay on the panel until search is requested: verified (new Selector and MultiSelector tests fail on the base and pass here; touch-emulated Chromium).
- Changeset: typing on a closed Selector trigger opens and focuses search with the typed query: verified (new typeahead test; Chromium keeps "Ban").
- Changeset: desktop popovers still focus search: verified (
Selector.tsx:1439,MultiSelector.tsx:1488; Chromium). - Description: a touch sheet opens without starting search: verified.
- Description: the change includes hug-height keyboard fitting and extends the BottomSheet keyboard path: false (reverted by the last commit; no BottomSheet or keyboard file in the diff).
- Description: searchable popovers, fine-pointer sheets and sheets without search keep their focus: verified.
- Description: no public prop is added: verified (API surface generator, 0 rows).
- Description: before, sheets focus search in forced and adaptive presentations: verified (new tests fail on the base).
- Description: after evidence at an implementation commit, with later commits leaving runtime source unchanged: false (that commit is not on this branch, and the last commit changes
Selector.tsx,SelectorBottomSheet.tsxandMultiSelector.tsx). - Description: search, selection, close and reopen still work: verified (new tests; Chromium).
- Description: the focused tests and the knowledge check pass: verified.
- Description rubric R1, R5 and R7: verified.
- Files
.changeset/selector-touch-search.md: cleardocs/specs/components/MultiSelector/MultiSelector.spec.md: waits on the owner decisiondocs/specs/components/Selector/Selector.spec.md: waits on the owner decisionpackages/core/src/MultiSelector/MultiSelector.test.tsx: clearpackages/core/src/MultiSelector/MultiSelector.tsx: clearpackages/core/src/Selector/Selector.test.tsx: clearpackages/core/src/Selector/Selector.tsx: clearpackages/core/src/Selector/SelectorBottomSheet.tsx: clearpackages/core/src/Selector/useSelectorPresentation.ts: clear- Pull request description: finding (stale claims)
There was a problem hiding this comment.
Thanks for bringing this up to date with main and for the clear description. This can't be approved yet: opening touch sheets on the panel intentionally changes the current Selector AR2 and MultiSelector FR8 focus rules, so approval needs an engineering owner to update that spec, either by accepting the amended clauses with a /approve-spec <full head SHA> comment on this pull request (you can do that yourself only if you are an engineering owner) or by saying what touch sheets should focus instead, including sheets opened with Enter, which now also land on the panel. Whatever that decision, this needs one change:
- Miss: the changeset tags this intentional change to documented focus behavior as
[fix], but the release record (AST-017 FR5) says a change that replaces a documented contract is not a fix, so please retag it[feat](still a patch) and say that search used to take focus when the sheet opened.
CI has not run on this head yet; a maintainer adds the ci:run label so it runs.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Claims
- Changeset: the
[fix]category: false (an intentional replacement of a documented contract is not a fix under AST-017 FR5). - Changeset: searchable touch sheets stay on the panel until search is requested: verified (the new Selector and MultiSelector tests fail on the base and pass here; touch-emulated Chromium).
- Changeset: typing on a closed Selector trigger opens and focuses search with the typed query: verified (new typeahead test; Chromium keeps "Ban").
- Changeset: desktop popovers still focus search: verified (
Selector.tsx:1450,MultiSelector.tsx:1503; Chromium). - Description: a tap opens a touch sheet without starting search: verified.
- Description: the panel becomes the dialog's autofocus target before it opens, and the show callbacks focus search only for popovers: verified (
SelectorBottomSheet.tsx:72-78). - Description: a typed opener keeps its first character, and closing clears the request: verified (new typeahead test).
- Description: searchable popovers and fine-pointer sheets keep search, and sheets without search keep the listbox: verified (code; Chromium for popovers).
- Description: no public prop is added: verified (API surface comparison, no rows).
- Description: reopening during the close transition starts on the panel: verified (new Selector test).
- Description: the caller-rendered trigger path (Tab to search, pick, sheet stays open, Escape returns focus): verified (new MultiSelector test).
- Description: keyboard fitting, BottomSheet sizing and the keyboard hook are out of scope: verified (no such file in the diff).
- Description: the focused tests, the four suites, typecheck and build pass: verified at this head; lint verified on the changed files.
- Description: the recordings show earlier revisions: taken as stated.
- Description: writing rubric R1, R5 and R7: verified.
- Changeset: the
- Files
.changeset/selector-touch-search.md: finding (category)docs/specs/components/MultiSelector/MultiSelector.spec.md: waits on the owner decisiondocs/specs/components/Selector/Selector.spec.md: waits on the owner decisionpackages/core/src/MultiSelector/MultiSelector.test.tsx: clearpackages/core/src/MultiSelector/MultiSelector.tsx: clearpackages/core/src/Selector/Selector.test.tsx: clearpackages/core/src/Selector/Selector.tsx: clearpackages/core/src/Selector/SelectorBottomSheet.tsx: clearpackages/core/src/Selector/useSelectorPresentation.ts: clear
There was a problem hiding this comment.
Thanks for retagging the changeset; that fixes the one change the last review asked for. This still can't be approved: opening touch sheets on the panel intentionally changes the current Selector AR2 and MultiSelector FR8 focus rules, so approval needs an engineering owner to update that spec, either by accepting the amended clauses with a /approve-spec <full head SHA> comment on this pull request (you can do that yourself only if you are an engineering owner) or by saying what touch sheets should focus instead, including sheets opened with Enter, which now also land on the panel.
Separately, the branch now conflicts with main, where the sheet's markup and initial focus moved from SelectorBottomSheet.tsx into the lazily loaded SelectorBottomSheetFrame.tsx, so the panel ref callback needs to move there. CI has not run on this head; once the branch merges cleanly, a maintainer adds the ci:run label so it runs.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Claims
- Changeset: the
[feat]category with a patch bump: verified (an intentional, compatible change to documented focus behaviour). - Changeset: searchable touch sheets open with focus on the panel instead of search: verified (sheet code and the new Selector and MultiSelector tests).
- Changeset: typing on a closed Selector trigger still opens and focuses search with the typed query: verified (code and the new typeahead test).
- Changeset: desktop popovers still focus search on open: verified (both show callbacks focus search only in a popover).
- Description: a tap opens a touch sheet without starting search: verified.
- Description: the panel becomes the native dialog's autofocus target before it opens, and the show callbacks focus search only for popovers: verified.
- Description: a typed opener keeps its first character, and closing clears the request: verified (code and test).
- Description: searchable popovers and fine-pointer sheets keep search, and sheets without search keep the listbox: verified in code.
- Description: reopening during the close transition starts on the panel: verified (test).
- Description: the caller-rendered trigger path (Tab to search, pick, sheet stays open, Escape returns focus): verified (test).
- Description: no public prop is added: verified from source.
- Description: keyboard fitting, sheet sizing and the keyboard hook are out of scope: verified (file list).
- Description: the focused tests, suites, typecheck, lint and build pass: stated for an earlier revision; not rerun on this head.
- Description: the recordings show earlier revisions: taken as stated.
- Changeset: the
- Files
.changeset/selector-touch-search.md: cleardocs/specs/components/MultiSelector/MultiSelector.spec.md: waits on the owner decisiondocs/specs/components/Selector/Selector.spec.md: waits on the owner decisionpackages/core/src/MultiSelector/MultiSelector.test.tsx: clear (conflicts withmain)packages/core/src/MultiSelector/MultiSelector.tsx: clearpackages/core/src/Selector/Selector.test.tsx: clearpackages/core/src/Selector/Selector.tsx: clearpackages/core/src/Selector/SelectorBottomSheet.tsx: clear (conflicts withmain)packages/core/src/Selector/useSelectorPresentation.ts: clear
There was a problem hiding this comment.
Thanks for merging main and moving the focus logic into the new on-demand sheet frame; the branch merges cleanly again, and the move keeps the behaviour the earlier reviews checked. This still can't be approved: opening touch sheets on the panel intentionally changes the current Selector AR2 and MultiSelector FR8 focus rules, so approval needs an engineering owner to update that spec, either by accepting the amended clauses with a /approve-spec <full head SHA> comment on this pull request (you can do that yourself only if you are an engineering owner) or by saying what touch sheets should focus instead, including sheets opened with Enter, which now also land on the panel. CI has not run on this head yet; a maintainer adds the ci:run label so it runs.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Claims
- Title: touch-sheet search focus is deferred: verified (the new Selector and MultiSelector sheet tests).
- Changeset: the
[feat]category with a patch bump: verified (an intentional change to documented focus behaviour, with no public API change). - Changeset: searchable touch sheets open with focus on the panel instead of search: verified (tests for an explicit Selector sheet and an adaptive MultiSelector sheet with a caller trigger; every other combination reaches the same sheet frame code).
- Changeset: people can browse without requesting the on-screen keyboard: verified as far as a DOM test can show it (search never takes focus on a tap open).
- Changeset: typing on a closed Selector trigger still opens and focuses search with the typed query: verified (sheet and popover tests).
- Changeset: desktop popovers still focus search on open: verified (existing Selector and MultiSelector popover tests).
- Description: the panel becomes the native dialog's autofocus target before it opens, and the show callbacks focus search only for popovers: verified (code and the new tests' native-focus stand-in).
- Description: a typed opener keeps its first character without duplicating it, and closing clears the request: verified (test).
- Description: the rule covers explicit and adaptive sheets, including the caller-rendered trigger: verified.
- Description: searchable popovers and fine-pointer sheets keep search, and sheets without search keep the listbox: verified (tests and the sheet frame's code).
- Description: reopening during the close transition starts on the panel: verified (test).
- Description: tapping search still allows picking an option, and the caller-trigger path (Tab to search, pick, sheet stays open, Escape returns focus) works: verified (tests).
- Description: no public prop is added: verified from source.
- Description: sheet sizing and the keyboard hook are out of scope, and no media is added: verified (file list).
- Description: the focused tests, suites, typecheck, lint and build pass: reported for an earlier revision; CI has not run them on this head.
- Description: the recordings show earlier revisions in desktop touch emulation: reported.
- Files
.changeset/selector-touch-search.md: cleardocs/specs/components/MultiSelector/MultiSelector.spec.md: waits on the owner decisiondocs/specs/components/Selector/Selector.spec.md: waits on the owner decisionpackages/core/src/MultiSelector/MultiSelector.test.tsx: clearpackages/core/src/MultiSelector/MultiSelector.tsx: clearpackages/core/src/Selector/Selector.test.tsx: clearpackages/core/src/Selector/Selector.tsx: clearpackages/core/src/Selector/SelectorBottomSheetFrame.tsx: clearpackages/core/src/Selector/useSelectorPresentation.ts: clear
fixes #11963
Primary intent
Let a person open a searchable touch sheet to browse options without starting search. This intentionally changes initial focus rather than restoring a requirement of the existing focus contract, so it uses the general-change template.
User or maintainer impact
Before this change, tapping a searchable Selector or MultiSelector to open its touch sheet immediately focused search. On a phone, that can bring up the keyboard and cover the options before the person sees them.
Problem and solution fit
Moving focus away from search after the sheet opens is too late: the browser may already have focused the input. For a searchable sheet on a coarse primary pointer, the selector makes the panel the native dialog's autofocus target before
showModal()runs. The selector's show callback still focuses search for popovers, but no longer does so for sheets.Typing on a closed, focused Selector trigger is a request to search. In that case the opening character seeds the query and the sheet moves focus to the input on the next frame. The person can keep typing without losing or duplicating the first character. Closing clears that request, so a later tap opens on the panel again.
Authority
#11963 describes the touch-sheet problem. At the merge base, Selector AR2 names search or the listbox as the focus destination. MultiSelector FR8 explicitly chooses search with
hasSearchin itsrenderTriggercontract.This PR proposes a different rule for a searchable bottom sheet on a coarse primary pointer: a tap focuses the panel without first focusing search; typing to open Selector moves focus into search with the typed query. The rule covers explicit
bottom-sheetandadaptiveresolved to a sheet, including MultiSelector's caller-rendered trigger. Searchable popovers and fine-pointer sheets still focus search; sheets without search still focus the listbox.Change and evidence
The implementation changes Selector, MultiSelector and their shared selector presentation. Regression tests, amendments to the two component contracts, and a Core patch changeset accompany it. No public prop is added.
Before and after
d96cb112ce, the component tests check that a tap focuses the panel without focusing search. Selector also starts on the panel when reopened during its close transition.Bon the closed trigger and thenanleft the input atB. The same sequence now leaves focus in search withBan; a later pointer reopen focuses the panel.Banana. With MultiSelector's caller-rendered trigger, Tab reaches search, selectingBananacallsonChangewith['Banana']and leaves the sheet open, and Escape returns focus to the trigger. Fine-pointer searchable popovers still focus search on open.Historical browser comparison
Playwright Chromium 149.0.7827.55 on macOS, 390 × 844, Neutral theme, light mode, English/LTR. Both controls were checked with a coarse pointer in forced bottom-sheet and compact adaptive presentations, and with a fine pointer in a forced popover: six cases per revision, twelve in total. Each case checks opening, intentional search, selection, close/focus return, and a completed-close reopen.
The two videos show the forced touch-sheet sequence for Selector followed by MultiSelector. They use the same fixture, native
showModal(), and focus-event, selected-value andonChangereadouts. AS-IS (6919cd34ac) shows search taking focus on open; TO-BE (193cd51173) shows the panel taking focus with no search-inputfocusinbefore the person taps it. These are earlier revisions, not recordings ofd96cb112ce. The videos do not show typing on the closed trigger or reopening during the close transition; the current component tests cover those cases. No recording fixture or media is added to the source diff.These are desktop touch-emulation recordings of browser focus, not recordings of an Android/iOS soft keyboard. They do not establish keyboard-fit geometry or screen-reader speech.
AS-IS
selector-touch-focus-as-is.mp4
TO-BE
selector-touch-focus-to-be.mp4
Scope
Components: Selector, MultiSelector
height="hug"keyboard fitting is outside this PR. NeitherBottomSheetsizing noruseMobileKeyboardchanges.Testing
pnpm exec vitest run --project ui packages/core/src/Selector/Selector.test.tsx packages/core/src/MultiSelector/MultiSelector.test.tsx -t 'opens a searchable.*touch sheet|keeps typing in search when a character opens a touch sheet' --maxWorkers=2— 3 focused jsdom tests passed ond96cb112ce.pnpm exec vitest run --project ui packages/core/src/Selector packages/core/src/MultiSelector packages/core/src/BottomSheet packages/core/src/keyboard --maxWorkers=2 --testTimeout=120000— 1,470 tests passed across 44 files in those four suites.pnpm -F @astryxdesign/core typecheck,pnpm lint:strict(including the repository and knowledge checks), andpnpm buildpassed locally.Writing rubric results
#-number reference.