Repository navigation
fix(Tokenizer): forward cancel to the search source - #8777
Conversation
|
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 |
|---|---|---|---|
| Tokenizer · Storybook | 90.1 kB (+8 B) · 18.3 kB CSS (0) | 2,224 (+1) | ✓ · ✓ · ✓ |
| PowerSearch | 281.7 kB (+4 B) · 23.5 kB CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 6.97 MB packed (+133 B); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 29 rows, core 40 rows; run pnpm api:report.
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Accessibility: 1 violation(s)
Accessibility Audit
Status: 1 accessibility violation(s) found — 1 serious.
Tokenizer - 1 issue(s)
- 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
- Rule:
color-contrast· Affects 2/31 stories · Learn more - WCAG: 1.4.3 (Level AA)
- Rule:
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Thanks, this looks ready to merge. Forwarding cancel restores the documented SearchSource.cancel behaviour for Tokenizer: the new cancellation tests fail without the change and pass with it, and a popup dismissed with Escape no longer reopens when a source that aborts on cancel would have answered. CI's only failure is a Breadcrumbs focus test that this change doesn't touch. One optional follow-up, outside this PR: because Tokenizer rebuilds its filtered source whenever value changes, BaseTypeahead's render-time cancel of the replaced source now reaches the caller's cancel after each selection, so a cancel that sets React state logs React's "Cannot update a component while rendering a different component" error.
[Automated review]
# Conflicts: # packages/core/src/Tokenizer/Tokenizer.test.tsx
There was a problem hiding this comment.
Requesting changes for one wording fix: the forwarding itself looks right, and five of the new cancellation tests fail without the line and pass with it.
- Regression: the Changeset says Tokenizer forwards
cancelso that a newer search, closing the menu, focus leaving or unmounting cancels the consumer's search, but now thatpresentationdefaults toadaptive, compact touch screens get the bottom-sheet presentation, which never callscancel(TokenizerBottomSheet.tsx), so please scope the Changeset to the inline field (suggested wording inline) or make the sheet callcanceltoo, with a test.
A non-blocking wording suggestion for the new source comment is inline. CI has not run on this head: the pull request is a draft from a fork, so it runs once it is marked ready and a maintainer adds the ci:run label.
[Automated review]
There was a problem hiding this comment.
Requesting changes for one wording fix: forwarding cancel looks right for the inline field, and the new cancellation tests fail without the line and pass with it.
- Regression: the Changeset says Tokenizer forwards
cancelso that a newer search, closing the menu, focus leaving or unmounting cancels the consumer's search, but withpresentationdefaulting toadaptive, compact touch screens get the bottom-sheet presentation, which never callscancel(TokenizerBottomSheet.tsx), so please scope the Changeset to the inline field (suggested wording in the earlier inline comment on the Changeset) or make the sheet callcanceltoo, with a test.
The earlier non-blocking suggestion on the new source comment still applies.
[Automated review]
…et does not call cancel yet
|
Deployment failed for project astryx with the following error: |
There was a problem hiding this comment.
Approved pending CI: CI is still running on this head.
Forwarding cancel restores the documented SearchSource.cancel behaviour for Tokenizer's inline field: five of the new cancellation tests fail without the line and pass with it, and a popup dismissed with Escape stays closed when a source that aborts on cancel would have answered late. The Changeset now names the inline field and says the bottom sheet does not call cancel yet, which resolves the earlier request. Two finished CI jobs failed in code this change does not touch (a NavigationStack frame-timing interaction test and a CLI build-ranking test), so a re-run of those jobs is the next step.
- Optional, not blocking: one pick now calls the source's
cancelthree times, once from BaseTypeahead's insertion effect when the rebuilt filtered source replaces the old one, so acancelshould be idempotent, and one that sets React state logs a development warning.
[Automated review]
There was a problem hiding this comment.
Approved.
Forwarding cancel restores the documented SearchSource.cancel behaviour for Tokenizer's inline field: five of the new cancellation tests fail without the line and pass with it, and a popup dismissed with Escape stays closed when a source that aborts on cancel would have answered late. Merging main left the change itself as it was. CI finished on this head with one failure, the Table focus-ring accessibility contract (and the test gate that reports it): it looks for tr[aria-expanded] rows that main already removed from TableTree, so it is not caused by this change and needs a fix on main rather than a re-run here.
- Optional, not blocking: one pick now calls the source's
cancelthree times, once from BaseTypeahead's insertion effect when the rebuilt filtered source replaces the old one, so acancelshould be idempotent, and one that sets React state logs a development warning.
[Automated review]
Tokenizer filters the supplied search source but does not forward its optional
cancelmethod. Cancellation should reach that source with the source as its receiver.Forward
cancelin one line; no new API. Sources withoutcancelcontinue to work as before. This forwarding alone does not prevent every late popup from a source that ignores cancellation.#6360 includes the same forwarding line in a broader change; this PR isolates it.
Testing
Complementary but independent of #8778: this PR forwards an abort attempt where the source supports cancellation; #8778 keeps a dismissed menu closed when pending search or bootstrap answers arrive, regardless of source cooperation with cancellation. Either proposal can land without the other; sequencing is deferred.