Skip to content

feat(Typeahead): Backspace or Delete on the selected Token clears the value - #10847

Merged
cixzhang merged 1 commit into
mainfrom
feat/typeahead-token-backspace
Nov 10, 2026
Merged

cixzhang merged 1 commit into
mainfrom
feat/typeahead-token-backspace

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Stack: #10544 → #10624 → #10625 → #10847
This stack lands bottom-first as a chain: #10544 merged; #10624 next; then #10625 and #10847 rebased on each merge, each with a fresh spec stamp, CodeBunny review and CI.

The top of the menu group's stack: it contains #10625's head (2249839); review only its own commit (Typeahead).

What changes

On a Typeahead with a selected value, the Token's button is the field's Tab stop. Backspace or Delete on that button now acts on the value:

  • With the clear button (hasClear, the default): it clears the value exactly as the clear button does. onChange(null) fires, a polite announcement says "Cleared {label}" through the shared live region, and focus moves to the empty input. This matches how a Tokenizer token is removed.
  • Without hasClear: it enters edit mode, as a click on the Token does.
  • A disabled field ignores both keys.

Scope

Components: Typeahead. Record: component:Typeahead FR12 (added here, with its verification row). New message: @astryx.typeahead.selectionCleared ("Cleared {label}").

Test plan

  • Red first: the three new Typeahead.test.tsx cases ("Backspace and Delete on the token") failed before the change and pass after it.
  • packages/core/src/Typeahead and packages/core/src/Tokenizer unit suites: 447 pass.

(Posted by Cindy's agent on her behalf.)

@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 9, 2026
@vercel

vercel Bot commented Nov 9, 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 10, 2026 12:06pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 9, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 9, 2026
@astracat-bot

astracat-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 10, 2026, 12:16 PM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 9, 2026
@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 6120af1

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · e493038

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
PowerSearch 291.4 kB (+105 B) · 24.2 kB CSS (0) — — · — · —
Typeahead 81.6 kB (+94 B) · 12.4 kB CSS (0) — ✓ · ✓ · ✓
BaseTypeahead 72.7 kB (0) · 10.9 kB CSS (0) — ✓ · ✓ · ✓
1 more component
Component Size LoC Visual · A11y · RTL
TypeaheadItem 6.4 kB (0) · 3.6 kB CSS (0) — ✓ · ✓ · ✓

Package size: @astryxdesign/core 7.25 MB packed (+721 B); no new dependencies.

API changes: none in this pull request

Committed API report behind this build: cli 36 rows, core 36 rows; run pnpm api:report.

Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.

Current run: CI concluded failure; parts of this report may be missing.


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.

This pull request needs an owner decision and changes before it can be approved.

Blocking:

  • The diff from main is 2,252 authored lines, 2,126 of them from #10544's open head, and this pull request is not in a declared stack: land #10544's stack first and rebase onto main so the diff is the 126-line Typeahead change, or rebase onto the stack's top and add this pull request to every listed pull request's identical Stack: line.
  • BaseTypeahead.menu, BaseTypeahead.handleRef, BaseTypeaheadHandle, BaseTypeaheadMenu, BaseTypeaheadListboxMenuInfo and BaseTypeaheadDialogMenuInfo (BaseTypeahead) are outside this pull request's scope (Typeahead): name them in the scope and get an owner decision, or split them into their own pull request (the rebase above does that).

Approval also waits on an engineering owner's decision about two Typeahead behaviors that no record states at this head: the announcement words "Cleared {label}" (FR12 says only that the announcement names the cleared value), and a closed dialog menu returning focus to the Token's button rather than the input (FR11 defers to BaseTypeahead FR15, which names the input). Stating both in FR12 and FR11 would settle it; an engineering owner then records the decision by commenting /approve-spec <full head SHA> on that head, which the author may do as an engineering owner.

The keyboard change itself works as described: the new tests fail before it and pass after it, and a real-browser check shows the value cleared, focus in the input and the announcement made.

[Automated review]

Comment thread packages/core/src/Typeahead/index.ts Resolved
Comment on lines +625 to +627
// Backspace or Delete on the selected token. With a clear button, it clears
// the value as that button does and says so in the shared live region.
// Without one, it starts editing, as a click does.

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 (INV29): this restates the handler below it. Drop it, or keep only the reason, for example: "Matches the clear button, and a click without one."

@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 6120af1

@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 11c5cf3

@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.

#10847: approve. Backspace or Delete on Typeahead's selected Token now clears the value when the clear button shows (onChange(null), one polite “Cleared {label}”, focus in the empty input) and starts editing when it does not, as the approved component:Typeahead FR12 says; the new tests fail without the change and pass with it, and CI passes.

#10544: approve.

#10624: approve.

#10625: approve.

Whole stack: pass. A pull request lands only when it and every pull request below it are approved, and all four are.

  • Optional: the comment at Typeahead.tsx:625-627 restates the handler below it; keep only the reason, or drop it.

[Automated review]

@cixzhang
cixzhang marked this pull request as ready for review November 9, 2026 20:03
@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 11c5cf3

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 18a6855

@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.

Approved pending CI: the heavy suites (build, test, docsite-test) are deferred on this head and have not run yet.

#10847: approve. Backspace or Delete on Typeahead's selected Token now clears the value when the clear button shows (onChange(null), one polite "Cleared {label}", focus in the empty input) and starts editing when it does not, as the approved component:Typeahead FR12 says; the new tests fail without the change and pass with it.

#10544: approve.

#10624: approve.

#10625: approve.

Whole stack: pass. A pull request lands only when it and every pull request below it are approved; all four are, so the stack can land together once CI passes.

  • Optional: the comment at Typeahead.tsx:625-627 restates the handler below it; keep only the reason, or drop it.

[Automated review]

@cixzhang
cixzhang force-pushed the feat/typeahead-token-backspace branch from 18a6855 to e493038 Compare November 10, 2026 11:57
@github-actions github-actions Bot removed the needs:design-review Affects visuals — Design should review label Nov 10, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec e493038

@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.

Approved pending CI: the heavy suites (build, test, docsite-test) are deferred on this head and have not run yet.

Backspace or Delete on Typeahead's selected Token now clears the value when the clear button shows (onChange(null), one polite "Cleared {label}", focus in the empty input) and starts editing when it does not, as the approved component:Typeahead FR12 says; the new tests fail without the change and pass with it. The pull requests listed below this one in its Stack: line have merged, so it is reviewed on its own.

  • Optional: the comment at Typeahead.tsx:625-627 restates the handler below it; keep only the reason, or drop it.

[Automated review]

@cixzhang
cixzhang merged commit 0a320be into main Nov 10, 2026
111 of 116 checks passed
@github-actions
github-actions Bot deleted the feat/typeahead-token-backspace branch November 11, 2026 06:05

This branch was successfully deployed

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

Labels

ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) 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