Skip to content

fix(Tokenizer): a confirmed Clear all in the sheet keeps focus on Clear all, not the search field - #9882

Merged
imdreamrunner merged 1 commit into
mainfrom
fix/tokenizer-sheet-clear-all-focus
Nov 4, 2026
Merged

imdreamrunner merged 1 commit into
mainfrom
fix/tokenizer-sheet-clear-all-focus

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Symptom

In Tokenizer's bottom-sheet presentation (presentation="bottom-sheet", and the default adaptive on 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's closeClearConfirmation focused searchRef after 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:

  • FR24 keeps Clear all aria-disabled and in the focus order with its reason ("Nothing to clear") when the draft is empty — the shape spec:AST-085 FR1/FR5 ask for so a control can hold focus and expose why it does nothing.
  • spec:AST-085 FR4's default is that a control which becomes disabled keeps focus; the record no longer names an exception.
  • It is the same destination the Cancel path uses, so both outcomes of the confirmation leave focus in one place, in the footer the person was acting in, with no keyboard; "All items removed" is still announced inside the sheet (AR6).
  • The sheet's other two focus rules keep their targets: a settled search that removes the focused row → the search field (a typed query is in progress there), a results drag → the sheet's panel.

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.tsx handleClearAll) 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:Tokenizer FR24: 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

  • R1 narration: none.
  • R2 research in the record: none.
  • R3 evidence naming a change: none.
  • R4 rejected alternatives over one line or outside a decision: none added (the rejected destinations are in this description, not the record).
  • R5 pull request or issue references: none.
  • R6 ruled open questions still listing options: unchanged.

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 on main (focus lands on the search field), passes with the fix.

Scope

  • One defect, one cause, one fix.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm exec vitest run packages/core/src/Tokenizer packages/core/src/internal packages/core/src/PowerSearch
  • core typecheck; strict ESLint on packages/core/src/Tokenizer
  • pnpm check:knowledge; pnpm check:changesets; changeset coverage; Prettier; git diff --check
  • The interaction lane (pr-interaction) runs in CI.

@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 4, 2026 7:32am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 4, 2026
@astracat-bot

astracat-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 4, 2026, 7:42 AM UTC

@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec c10dfb9

@imdreamrunner

Copy link
Copy Markdown
Contributor Author

@astracat-bot review

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md places the fix in "Tokenizer's experimental.presentation sheet". This same release removes that prop (.changeset/tokenizer-experimental-presentation-removed.md), and the sheet now comes from presentation (by default adaptive, which shows it on compact touch screens). Please reword it, for example: "Tokenizer's bottom-sheet presentation (presentation=\"bottom-sheet\", and the default adaptive on 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +358 to +362
// 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +1006 to +1007
// natively disabled button does — a confirmed Clear all keeps
// focus here (FR24).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@imdreamrunner
imdreamrunner force-pushed the fix/tokenizer-sheet-clear-all-focus branch from c10dfb9 to 9c0bb90 Compare November 4, 2026 06:10
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec 9c0bb90

@imdreamrunner

Copy link
Copy Markdown
Contributor Author

@astracat-bot review

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 9c0bb90

Storybook · Sandbox · built from this PR's head

Modified components

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

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@imdreamrunner
imdreamrunner force-pushed the fix/tokenizer-sheet-clear-all-focus branch from 9c0bb90 to c91fa37 Compare November 4, 2026 07:24
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec c91fa37

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

@imdreamrunner
imdreamrunner merged commit b4f383d into main Nov 4, 2026
62 checks passed
@github-actions
github-actions Bot deleted the fix/tokenizer-sheet-clear-all-focus branch November 5, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — c91fa375 Deployed Nov 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant