Repository navigation
fix(Tokenizer): a confirmed Clear all in the sheet keeps focus on Clear all, not the search field - #9882
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec c10dfb9 |
|
@astracat-bot review |
There was a problem hiding this comment.
Requesting changes for one wording fix. The new focus target is approved by a spec owner at this head and proven by tests that fail on the base and pass here.
- The changeset names a removed prop:
.changeset/tokenizer-sheet-clear-all-keeps-focus.mdplaces the fix in "Tokenizer'sexperimental.presentationsheet". This same release removes that prop (.changeset/tokenizer-experimental-presentation-removed.md), and the sheet now comes frompresentation(by defaultadaptive, which shows it on compact touch screens). Please reword it, for example: "Tokenizer's bottom-sheet presentation (presentation=\"bottom-sheet\", and the defaultadaptiveon compact touch screens): …".
Two optional comment rewrites are suggested inline, to keep each sentence short and about one thing.
[Automated review]
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] Tokenizer's `experimental.presentation` sheet: a confirmed Clear all keeps focus on the Clear all action, now disabled with its reason, instead of moving it to the search field, which raised the on-screen keyboard over the rows the person had just cleared. The inline presentation is unchanged. |
There was a problem hiding this comment.
Tokenizer no longer has an experimental prop. .changeset/tokenizer-experimental-presentation-removed.md removes experimental.presentation in this same release, and the sheet comes from presentation (the default adaptive shows it on compact touch screens). Suggested wording:
[fix] Tokenizer's bottom-sheet presentation (`presentation="bottom-sheet"`, and the default `adaptive` on compact touch screens): a confirmed Clear all keeps focus on the Clear all action, now disabled with its reason, instead of moving it to the search field, which raised the on-screen keyboard over the rows the person had just cleared. The inline presentation is unchanged.
| // a confirm and after a cancel alike. A confirmed clear leaves Clear all | ||
| // aria-disabled, still in the focus order with its reason, so it keeps | ||
| // focus, as a control that becomes disabled does (FR24, `spec:AST-085` | ||
| // FR4); the search field would raise the on-screen keyboard over the rows | ||
| // the person has just cleared. A confirmed clear is announced too — a |
There was a problem hiding this comment.
Non-blocking (source-comment style): "back on Clear all after a confirm and after a cancel alike" restates clearAllRef.current?.focus() below, and the next sentence runs about 45 words over two topics. A shorter version that keeps only the reasons:
After a clear, Clear all is aria-disabled but stays focusable, so it keeps focus. Focus on the search field opens the on-screen keyboard over the cleared rows.
| // natively disabled button does — a confirmed Clear all keeps | ||
| // focus here (FR24). |
There was a problem hiding this comment.
Non-blocking (source-comment style): the sentence this extends now runs about 45 words. A shorter version:
With a tooltip, Button uses aria-disabled, so Clear all stays focusable after a clear.
c10dfb9 to
9c0bb90
Compare
|
/approve-spec 9c0bb90 |
|
@astracat-bot review |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| PowerSearch | 235.9 kB (0) · 21.8 kB CSS (0) | — | — · — · — |
| Tokenizer · Storybook | 69.3 kB (0) · 17.1 kB CSS (0) | 2,112 (−2) | ✓ · ✓ · ✓ |
Package size: @astryxdesign/core 6.30 MB packed (−70 B); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: theme-butter 1 row, theme-chocolate 1 row, theme-gothic 1 row, theme-matcha 1 row, theme-neutral 1 row, theme-stone 1 row, theme-y2k 1 row; run pnpm api:report.
Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Approving. Confirming Clear all in Tokenizer's sheet now keeps focus on Clear all instead of the search field, as the rewritten FR24 says; that rewrite has a spec owner's approval at this head, the three updated tests fail on the base and pass here, and the changeset now names the bottom-sheet presentation.
Approved pending CI: CI is still running on this head. The one lint error is in packages/core/src/DateInput/__tests__/WheelContrast.a11y.chromium.spec.ts, a file this pull request does not change.
[Automated review]
…ar all, not the search field Moving focus to the search field raised the on-screen keyboard over the rows the person had just cleared. Clear all is aria-disabled and still in the focus order after the clear, so it keeps focus, as a control that becomes disabled does; cancel returns there too. "All items removed" is still announced inside the sheet. The inline presentation is unchanged.
9c0bb90 to
c91fa37
Compare
|
/approve-spec c91fa37 |
There was a problem hiding this comment.
Approving. Confirming Clear all in Tokenizer's sheet now keeps focus on Clear all instead of the search field, as the rewritten FR24 says; that rewrite has a spec owner's approval at this head, the three updated tests fail on the base and pass with the change, and the changeset names the bottom-sheet presentation.
Approved pending CI: three unit-test shards and the docsite test are still running on this head; lint, typecheck, build and the interaction tests have passed.
[Automated review]
Symptom
In Tokenizer's bottom-sheet presentation (
presentation="bottom-sheet", and the defaultadaptiveon compact touch screens), confirming Clear all moved focus to the sheet's search field. On a phone that raises the on-screen keyboard over the rows the person has just cleared, at the moment they are most likely to look at the list or close the sheet. (Owner report: "tokenizer clear all should not focus on search input".)Root cause
TokenizerSheetContent'scloseClearConfirmationfocusedsearchRefafter a confirmed clear (and Clear all only after a cancel). The record's FR24 named the search field as the destination on the reasoning that "the search field is where the next selection starts", which is a desktop intuition: in the sheet the search field means the keyboard.Fix
After a confirmed clear, focus returns to Clear all, the control the person pressed. It is the destination the records already support:
aria-disabledand in the focus order with its reason ("Nothing to clear") when the draft is empty — the shapespec:AST-085FR1/FR5 ask for so a control can hold focus and expose why it does nothing.spec:AST-085FR4's default is that a control which becomes disabled keeps focus; the record no longer names an exception.Rejected: the sheet's panel (orienting, but it drops the person out of the footer they were in and reads nothing on focus); the first row (after a clear every row is unchecked and the first one is arbitrary; a checkbox taking focus unasked reads as a selection step); the dialog title (the sheet has no visible title element).
The inline presentation's Clear all (
Tokenizer.tsxhandleClearAll) is unchanged: it focuses the field's input, which on desktop is the right place and raises no keyboard. If the owner wants the inline path reviewed too, that is a separate change under the desktop no-regression bar.Record
component:TokenizerFR24: the post-confirm destination is Clear all (aria-disabled, in the focus order), with the keyboard reason, cancel unchanged. Present tense; no other row names the old target.Writing rubric results
Regression test
TokenizerBottomSheet.test.tsx— "keeps focus on Clear all after a confirmed Clear all — aria-disabled, in the focus order — and never moves it to the search field, which would raise the keyboard (FR24; AST-085 FR4)": fails onmain(focus lands on the search field), passes with the fix.Scope
Testing
pnpm exec vitest run packages/core/src/Tokenizer packages/core/src/internal packages/core/src/PowerSearchpackages/core/src/Tokenizerpnpm check:knowledge;pnpm check:changesets; changeset coverage; Prettier;git diff --checkpr-interaction) runs in CI.