Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the new public API, and four fixes are needed.
No current spec covers the controlled query / defaultQuery pair: the BaseTypeahead spec says the query text is internal and that a pick clears it. An engineering owner needs to decide whether to admit the pair, and how a controlled pick, a value set while the field is idle, a focused clear and the Tokenizer sheet's close should behave. They record it by commenting /approve-spec <full head SHA> (the author may do so if they are an engineering owner) or by updating the records.
Blocking findings:
- When the app echoes
onChangeQueryintoquery(the documented usage), the pick's reported''runs the outside-change path (BaseTypeahead.tsx:1806-1813and:1728-1733). That drops Tokenizer's "Added …" announcement and, withhasEntriesOnFocus, reopens the list right after the pick. Please fix it and add tests for that echo path. queryRef.current = query(BaseTypeahead.tsx:921) andsheetQueryRef.current = queryProp(Tokenizer.tsx:1211-1213) write refs during render, which react-component-runtime INV17 forbids. Both can be deleted, because the handler and the sheet's press already read the current value.- The new query layout Effect (
BaseTypeahead.tsx:1728-1733) does not name the external system it synchronizes, and itsset-state-in-effectdisables give no justification (INV3). - The description and changeset present
onChangeQuery's reports for a pick, a clear and entering edit mode as new, but the base already makes all three. Please reword them so the release note does not announce a change.
Claims and files checked
Claims:
- Adds optional
queryanddefaultQueryto Typeahead, Tokenizer and BaseTypeahead: verified (Typeahead.tsx:232,:236;Tokenizer.tsx:341,:345;BaseTypeahead.tsx:261,:266). - Passing
queryshows that text, and typing reports throughonChangeQuery: verified (test "shows a query the app sets and reports typing", all three components). - Holding
queryafter a pick keeps the text: verified (test "keeps the text after a pick when the app holds the query"). - Following
onChangeQuery('')empties the field after a pick: partly false. It empties, but drops Tokenizer's "Added" announcement and, withhasEntriesOnFocus, reopens the list (Chromium and unit probes). defaultQuerystarts the field with text the field then owns: verified (tests "shows defaultQuery without opening the listbox", "lets an uncontrolled field type after defaultQuery").- Omitting both keeps today's behavior: verified (the four named suites pass on the head; the uncontrolled path is unchanged).
- A value set from outside does not move focus, open the list or announce a count unless the field has focus: verified (test "does not move focus or open the listbox…"; Chromium probe).
- A focused clear closes the list as emptying the field does: verified (test "closes the listbox when the app clears the query while the field is focused";
BaseTypeahead.tsx:1656-1689). - A search the app starts while the field is idle keeps its answer for the next open: verified (
BaseTypeahead.tsx:1252-1265,:1375-1380; a probe that focuses afterwards shows the results). onChangeQuerynow reports a pick, a clear and entering edit mode: false. The base already reports all three (baseBaseTypeahead.tsx:1736, baseTypeahead.tsx:524and its synthetic input event, basehandleClear).value/onChangeand theming are unchanged: verified (diff; the API generator lists only the six added props).- The pair follows the
isOpen/defaultIsOpenpattern of other fields: verified (Collapsible.tsx:247,:253). - 469 tests pass in the four named files: verified (re-run on the head).
- The changeset's
patchbump matches its[feat]category: verified against the contribution guide.
Files:
.changeset/typeahead-and-tokenizer-add-a-controlled-api-to--l7mf.md: finding (claim wording).packages/core/src/Typeahead/BaseTypeahead.tsx: findings (echoed pick, render-time ref write, Effect note).packages/core/src/Tokenizer/Tokenizer.tsx: finding (render-time ref write).packages/core/src/Tokenizer/TokenizerBottomSheet.tsx: clear.packages/core/src/Typeahead/Typeahead.tsx: clear.packages/core/src/Typeahead/BaseTypeahead.test.tsx: gap (no test echoesonChangeQueryintoquery).packages/core/src/Typeahead/BaseTypeahead.doc.mjs,Typeahead.doc.mjs,packages/core/src/Tokenizer/Tokenizer.doc.mjs: clear (they match the JSDoc).
Record the empty query a controlled pick reports so echoing it back into query does not re-run the external path. That path cleared the Added announcement and, with hasEntriesOnFocus, bootstrapped the list open again. A held query after a pick is left alone. Drop render-time writes on queryRef and sheetQueryRef. Name the INV3 systems the query-prop layout effect synchronizes.
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the new public API, and two wording fixes are needed; the four fixes asked for in the last review are in.
No current spec covers the controlled query / defaultQuery pair: the BaseTypeahead spec says the query text is internal and that a pick clears it. An engineering owner needs to decide whether to admit the pair, and how a held query after a pick, a value set while the field is idle, a focused clear and the Tokenizer sheet's close should behave; they record it by commenting /approve-spec <full head SHA> on this pull request (the author may do so if they are an engineering owner) or by updating the records.
Blocking findings:
- Miss: the new
querydocs (Typeahead.doc.mjs:257,BaseTypeahead.doc.mjs:246,Tokenizer.doc.mjs:216and the matching Chinese entries) and the description say a focused clear closes the listbox, but withhasEntriesOnFocusit shows the focus entries (BaseTypeahead.tsx:1659-1661), so please reword them to say it does what emptying the field does: the listbox closes, or shows the focus entries withhasEntriesOnFocus. - The description still says
onChangeQuery"now reports" a pick, a clear and entering edit mode, which the base already does, so please reword it the way the changeset now reads.
Two smaller points: Tokenizer's docs list "entering edit mode", which Tokenizer does not have, and a test with default props that echoes the pick and asserts the "Added …" announcement would cover the other half of the echo fix.
Claims and files checked
Claims:
- Adds optional
queryanddefaultQueryto Typeahead, Tokenizer and BaseTypeahead: verified (Typeahead.tsx:232,:236;Tokenizer.tsx:341,:345;BaseTypeahead.tsx:261,:266). - Passing
queryshows that text, and typing reports throughonChangeQuery: verified (test "%s shows a query the app sets and reports typing", all three components). - The field reports a pick, a clear and entering edit mode through
onChangeQuery: verified, and already true on the base. onChangeQuery"now" reports those changes: false; the base already reports all three (baseBaseTypeahead.tsx:1736, baseTypeahead.tsx:524, baseTypeahead.tsx:614-617).- Holding
queryafter a pick keeps the text: verified (test "keeps the text after a pick when the app holds the query"). - Following
onChangeQuery('')empties the field after a pick: verified (new Tokenizer echo test; in a browser the field empties, the list stays closed and "Added …" is announced). defaultQuerystarts the field with text it then owns: verified (tests "shows defaultQuery without opening the listbox", "lets an uncontrolled field type after defaultQuery").- Omitting both keeps today's behaviour: verified (the four named suites pass, 471 tests).
- A value set from outside does not move focus, open the list or announce a count unless the field has focus: verified (test "does not move focus or open the listbox when the app sets the query while idle"; browser check).
- A focused clear closes the listbox: true without
hasEntriesOnFocus(test "closes the listbox when the app clears the query while the field is focused"); false with it, where the focus entries show. - A search the app starts while the field is idle keeps its answer for the next open: verified (browser check: focusing opens it and announces "1 result").
value/onChangeand theming are unchanged: verified (the API generator lists only the six added props).- The pair follows
isOpen/defaultIsOpen: verified (Collapsible.tsx:247). - 469 tests pass in the four named files: outdated; 471 pass at this head, with the two new tests.
- The unused
composeEventHandlersimport inTypeahead.tsxis unchanged: verified (Typeahead.tsx:66, on base and head). - Changeset:
queryanddefaultQuerylet an app set, clear, restore or keep the typed text: verified. - Changeset:
onChangeQuerykeeps reporting every change, its own included: verified. - Changeset: a change from outside does not move focus, open the listbox or announce unless focused: verified.
- Changeset: a
patchbump for a[feat]entry: consistent with the repository's other[feat]changesets.
Files:
.changeset/typeahead-and-tokenizer-add-a-controlled-api-to--l7mf.md: clear.packages/core/src/Typeahead/BaseTypeahead.tsx: clear (echo fix, render writes and Effect note verified).packages/core/src/Typeahead/Typeahead.doc.mjs,packages/core/src/Typeahead/BaseTypeahead.doc.mjs: finding (focused-clear wording).packages/core/src/Tokenizer/Tokenizer.doc.mjs: finding (focused-clear wording); note ("entering edit mode").packages/core/src/Tokenizer/Tokenizer.tsx: note ("entering edit mode" in the JSDoc).packages/core/src/Tokenizer/TokenizerBottomSheet.tsx: clear.packages/core/src/Typeahead/Typeahead.tsx: clear.packages/core/src/Typeahead/BaseTypeahead.test.tsx: clear.packages/core/src/Tokenizer/Tokenizer.test.tsx: note (covers the echo withhasEntriesOnFocusonly).
With hasEntriesOnFocus a focused clear shows the focus entries rather than closing the listbox, so the query prop description now says so in Typeahead, BaseTypeahead and Tokenizer, English and Chinese.
Tokenizer has no edit mode (that is Typeahead's selected value), so the query and onChangeQuery docs in Tokenizer.tsx and Tokenizer.doc.mjs (English, Chinese and dense) now name only a pick and a clear.
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the new public API, and one description fix and one size report are also needed; the docs fixes asked for in the last review are in.
No current spec covers the controlled query / defaultQuery pair: the BaseTypeahead spec says the query text is internal and that a pick clears it. An engineering owner needs to decide whether to admit the pair, and how a held query after a pick, a value set while the field is idle, a focused clear and the Tokenizer sheet's close should behave; they record it by commenting /approve-spec <full head SHA> on this pull request (the author may do so if they are an engineering owner) or by updating the records.
Blocking findings:
- The description still says a focused clear closes the listbox (Problem and solution fit, Public delta and Evidence), but with
hasEntriesOnFocusit shows the focus entries (BaseTypeahead.tsx:1659-1661), so please reword those sentences the way the docs now read and update the "469 tests passed" count, since 471 pass on this head. - Newly live check: the description does not report the first-load gzip delta that the component import-boundaries rule asks for when an optional feature is added and a shared module grows, so please state it per page, base against head (our build measured about +243 B on a page with Typeahead, +249 B with Tokenizer, and no change on the four reference pages).
Two smaller points: BaseTypeahead's docs still list "entering edit mode" among the onChangeQuery reports although only Typeahead has an edit mode, and a test with default props that echoes the pick and asserts the "Added …" announcement would lock in the echo fix.
Claims and files checked
Claims:
- Typeahead, Tokenizer and BaseTypeahead take
queryanddefaultQuery: verified (API surface, tests). - Passing
queryshows that text, andonChangeQuerykeeps reporting every change: verified (BaseTypeahead.tsx:1637-1639,:1832-1834, tests). - Holding
queryafter a pick keeps the text, and following''empties it: verified (tests, probe). defaultQuerystarts with text the field then owns, without opening the listbox: verified (tests).- Omitting both keeps today's behaviour: verified (471 tests pass).
- A change from outside moves no focus and opens or announces nothing unless the field has focus: verified (Chromium).
- A focused clear closes the listbox: false with
hasEntriesOnFocus. - A search started while the field is idle keeps its answer for the next open: verified (Chromium, async probe).
- 469 tests pass: outdated, 471 pass.
- No theming attributes change, and
value/onChangeare unchanged: verified. - The unused
composeEventHandlersimport warning is unchanged: verified.
Files:
- The changeset: clear.
Tokenizer.doc.mjs: clear.Tokenizer.test.tsx: clear.Tokenizer.tsx: clear.TokenizerBottomSheet.tsx: clear.BaseTypeahead.doc.mjs: lists edit mode (non-blocking).BaseTypeahead.test.tsx: clear.BaseTypeahead.tsx: JSDoc lists edit mode (non-blocking).Typeahead.doc.mjs: clear.Typeahead.tsx: clear.
BaseTypeahead has no edit mode, so its query and onChangeQuery docs list only a pick and a clear. Add a Tokenizer test with default props that echoes the pick's empty query and asserts the Added announcement.
|
Thanks. Pushed 2595802 and updated the description.
The |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the new public API, and one docs fix is needed after it; the fixes asked for in the last review are in.
No current spec covers the controlled query / defaultQuery pair: the BaseTypeahead spec says the query text is internal and that a pick clears it. An engineering owner needs to decide whether to admit the pair, and how a held query after a pick, a value set while the field is idle, a focused clear and the Tokenizer sheet's close should behave; they record it by commenting /approve-spec <full head SHA> on this pull request (the author may do so if they are an engineering owner) or by updating the records.
Blocking findings:
- Miss: the dense docs for
query(BaseTypeahead.doc.mjs:547,Tokenizer.doc.mjs:926) say a value set from outside never opens the listbox, but a set while the field has focus opens it, as the focused-set test atBaseTypeahead.test.tsx:371-394shows, so please reword them to "Setting it from outside does not move focus. While the field is unfocused, it does not open the listbox or announce a result count."
CI has not run on this head yet: a maintainer adds the ci:run label so it runs.
Claims and files checked
Claims:
- Typeahead, Tokenizer and BaseTypeahead take
queryanddefaultQuery: verified (generated API delta, tests). - Passing
queryshows that text, andonChangeQuerykeeps reporting every change, the field's own included: verified (BaseTypeahead.tsx:1637-1639,:1832-1834, tests). - Holding
queryafter a pick keeps the text, and following the reported empty query empties it: verified (BaseTypeahead.test.tsx:396,Tokenizer.test.tsx:2789, Chromium). defaultQuerystarts the field with text it then owns, without opening the listbox: verified (BaseTypeahead.test.tsx:212,:478).- Omitting both keeps today's behaviour: verified (472 tests pass).
- A change from outside moves no focus and opens or announces nothing unless the field has focus: verified (
BaseTypeahead.test.tsx:344, Chromium). - A focused clear does what emptying the field does, closing the list or showing the focus entries with
hasEntriesOnFocus: verified (BaseTypeahead.tsx:1660,BaseTypeahead.test.tsx:371). - A search the app starts while the field is idle keeps its answer for the next open, with the list closed and nothing announced: verified (
BaseTypeahead.tsx:1255-1268, Chromium). - First-load size grows about +235 B with Typeahead, +257 B with Tokenizer and +208 B with BaseTypeahead, with other pages unchanged: verified within a few bytes (+243 B, +249 B, +206 B, 0 B in our build).
- 472 tests pass in the four named files: verified.
value/onChangeare unchanged and no theming attributes change: verified (diff).- The unused
composeEventHandlersimport warning inTypeahead.tsxis unchanged: verified. - The changeset's description of the props and of
onChangeQuery: verified (same evidence as above). - The dense docs say a value set from outside never opens the listbox: false while the field has focus.
Files:
- The changeset: clear.
Tokenizer.doc.mjs: densequeryentry (blocking).Tokenizer.test.tsx: clear.Tokenizer.tsx: clear.TokenizerBottomSheet.tsx: clear.BaseTypeahead.doc.mjs: densequeryentry (blocking).BaseTypeahead.test.tsx: clear.BaseTypeahead.tsx: two comments restate names (non-blocking).Typeahead.doc.mjs: clear.Typeahead.tsx: clear.
Review mode: full — reason: author-not-engowner
…e focused The query docs for BaseTypeahead and Tokenizer now say a set while the field is unfocused does not open the listbox or announce a result count, which matches the focused-set behavior. Two comments in BaseTypeahead.tsx drop the sentence that restated the name.
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the new public API, and one fix is needed after it; the docs and comment fixes asked for in the last review are in.
No current spec covers the controlled query / defaultQuery pair: the BaseTypeahead spec says the query text is internal and that a pick clears it, and the search-vocabulary spec admits a new search capability only against it. An engineering owner needs to decide whether to admit the pair, and how a held query after a pick, a value set while the field is idle, a focused clear and the Tokenizer sheet's close should behave; they record it by commenting /approve-spec <full head SHA> on this pull request (the author may do so if they are an engineering owner) or by updating the records.
Blocking findings:
- Miss: an app that sets
querywhile the field is unfocused and then moves focus into it within the debounce (150 ms by default) gets a focused field showing its text with the list closed and no result announcement, because the scheduled search keeps its idle flag (BaseTypeahead.tsx:1642-1646) andhandleFocus(:1977-1983) does not clear it, so please clearidleSearchRefon focus and add a test that focuses before the debounce elapses and expects the list to open.
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:
- Typeahead, Tokenizer and BaseTypeahead take
queryanddefaultQuery: verified (generated API delta, tests). - Passing
queryshows that text, andonChangeQuerykeeps reporting every change, the field's own included: verified (BaseTypeahead.tsx:1637-1639,:1832-1834, tests). - Holding
queryafter a pick keeps the text, and following the reported empty query empties it: verified (BaseTypeahead.test.tsx:396,Tokenizer.test.tsx:2743,:2789, Chromium). defaultQuerystarts the field with text it then owns, without opening the listbox: verified (BaseTypeahead.test.tsx:212,:230,:478).- Omitting both keeps today's behaviour: verified (472 tests pass).
- A change from outside moves no focus and opens or announces nothing unless the field has focus: verified for the focus state at the time of the change (
BaseTypeahead.test.tsx:344, Chromium); a focus that arrives during the debounce is not honoured (blocking finding). - A focused clear does what emptying the field does, closing the list or showing the focus entries with
hasEntriesOnFocus: verified (BaseTypeahead.tsx:1659-1661,BaseTypeahead.test.tsx:371). - A search the app starts while the field is idle keeps its answer for the next open, with the list closed and nothing announced: verified (
BaseTypeahead.tsx:1255-1268, Chromium), except an open during the debounce (blocking finding). - First-load size grows about +235 B with Typeahead, +257 B with Tokenizer and +208 B with BaseTypeahead, with other pages unchanged: verified within a few bytes (+243 B, +249 B, +206 B, and 0 B on Text, Button and Table in our build).
- 472 tests pass in the four named files: verified.
value/onChangeare unchanged and no theming attributes change: verified (diff, API delta).- The unused
composeEventHandlersimport warning inTypeahead.tsxis unchanged: verified (Typeahead.tsx:66at base and head). - The dense docs now say an outside set opens nothing only while the field is unfocused: verified (
BaseTypeahead.doc.mjs:547,Tokenizer.doc.mjs:926). - The changeset's description of the props and of
onChangeQuery: verified (same evidence as above).
Files:
- The changeset: clear.
Tokenizer.doc.mjs: clear.Tokenizer.test.tsx: clear.Tokenizer.tsx: clear.TokenizerBottomSheet.tsx: clear.BaseTypeahead.doc.mjs: clear.BaseTypeahead.test.tsx: no test focuses the field during the debounce after an outside set (part of the blocking finding).BaseTypeahead.tsx: focus during the debounce after an outside set (blocking).Typeahead.doc.mjs: clear.Typeahead.tsx: clear.
Focusing the field before the debounce of a query the app set while idle now clears the idle flag, so the search opens the listbox and announces. Adds a test for that timing.
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the new public API, and one small description fix is needed after it; the focus fix asked for in the last review is in.
No current spec covers the controlled query / defaultQuery pair: the BaseTypeahead spec says the query text is internal and that a pick clears it, and the search-vocabulary spec admits a new search capability only against it. An engineering owner needs to decide whether to admit the pair, and how a held query after a pick, a value set while the field is idle, a focused clear and the Tokenizer sheet's close should behave; they record it by commenting /approve-spec <full head SHA> on this pull request (the author may do so if they are an engineering owner) or by updating the records.
Blocking findings:
- The description's Testing section says 472 tests pass in the four named files, but this head runs 473 there (the new focus test), so please update the count.
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:
- Typeahead, Tokenizer and BaseTypeahead take
queryanddefaultQuery: verified (generated API delta, tests). - Passing
queryshows that text, andonChangeQuerykeeps reporting every change, the field's own included: verified (BaseTypeahead.tsx:1637-1639,:1832-1834,BaseTypeahead.test.tsx:295). - Holding
queryafter a pick keeps the text, and following the reported empty query empties it: verified (BaseTypeahead.test.tsx:426,:459,Tokenizer.test.tsx:2743,:2789, Chromium). defaultQuerystarts the field with text it then owns, without opening the listbox: verified (BaseTypeahead.test.tsx:212,:230,:508).- Omitting both keeps today's behaviour: verified (473 tests pass; the uncontrolled branch keeps its code).
- A change from outside moves no focus and opens or announces nothing unless the field has focus: verified (
BaseTypeahead.test.tsx:344,:371, Chromium), including a focus that lands before the debounced search runs (BaseTypeahead.tsx:1977-1981). - A focused clear does what emptying the field does, closing the list or showing the focus entries with
hasEntriesOnFocus: verified (BaseTypeahead.tsx:1659-1661,BaseTypeahead.test.tsx:401). - A search the app starts while the field is idle keeps its answer for the next open, with the list closed and nothing announced: verified (
BaseTypeahead.tsx:1255-1268, Chromium). - First-load size grows about +235 B with Typeahead, +257 B with Tokenizer and +208 B with BaseTypeahead, with other pages unchanged: verified within a few bytes (+246 B, +252 B, +211 B, and 0 B on Text, Heading, Button, IconButton, Link and Table in our build).
- 472 tests pass in the four named files: false; 473 pass at this head (blocking finding).
- The demo note's 469 passing tests: describes a run on the first revision of this pull request, not this one.
value/onChangeare unchanged and no theming attributes change: verified (diff, API delta).- The unused
composeEventHandlersimport warning inTypeahead.tsxis unchanged: verified (Typeahead.tsx:66at base and head). - Docs ship in
Typeahead.doc.mjs,Tokenizer.doc.mjsandBaseTypeahead.doc.mjs: verified. - The changeset's description of the props and of
onChangeQuery: verified (same evidence as above). - Public text and artifacts carry no internal context: verified.
Files:
- The changeset: clear.
Tokenizer.doc.mjs: clear.Tokenizer.test.tsx: clear.Tokenizer.tsx: clear.TokenizerBottomSheet.tsx: clear.BaseTypeahead.doc.mjs: clear.BaseTypeahead.test.tsx: clear.BaseTypeahead.tsx: clear.Typeahead.doc.mjs: clear.Typeahead.tsx: clear.
|
🤖 (Posted by Cindy's agent.) Hi @mvanhorn, thank you for this! We've just started CI on it, but GitHub can't run it while the branch conflicts with |
Resolve conflicts with the opening query added on main: the uncontrolled query starts from defaultQuery, then the opening query, and a controlled query takes precedence over both. The Tokenizer passes query and defaultQuery inside the OpeningQueryContext wrapper and seeds the sheet from them.
|
Thanks @cixzhang. Merged current The conflicts were in BaseTypeahead and Tokenizer, against upstream's new opening-query context. The two compose like this:
On 3f5e523 these exited 0:
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Typeahead | 100.3 kB (+270 B) · 14.8 kB CSS (0) | — | ✓ · ✓ · ✓ |
| Tokenizer · Storybook | 119.0 kB (+251 B) · 22.4 kB CSS (0) | 2,710 (+19) | ✓ · ✓ · ✓ |
| BaseTypeahead | 88.7 kB (+249 B) · 12.3 kB CSS (0) | — | ✓ · ✓ · ✓ |
✓ passed · ✗ needs a fix · Δ changed, for review in the shots below · ↻ needs re-verify · — did not run
2 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| PowerSearch | 327.4 kB (+203 B) · 27.8 kB CSS (0) | — | — · — · — |
| TypeaheadItem | 6.7 kB (0) · 3.6 kB CSS (0) | — | ✓ · ✓ · ✓ |
Package size: @astryxdesign/core 8.18 MB packed (+5.5 kB); no new dependencies.
API changes: core +6 · ~0 · −0
6 API changes (advisory)
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| + | core |
. · Components · component BaseTypeahead |
prop defaultQuery?: string |
<BaseTypeahead defaultQuery={…} /> |
| + | core |
. · Components · component BaseTypeahead |
prop query?: string |
<BaseTypeahead query={…} /> |
| + | core |
. · Components · component Tokenizer |
prop defaultQuery?: string |
<Tokenizer defaultQuery={…} /> |
| + | core |
. · Components · component Tokenizer |
prop query?: string |
<Tokenizer query={…} /> |
| + | core |
. · Components · component Typeahead |
prop defaultQuery?: string |
<Typeahead defaultQuery={…} /> |
| + | core |
. · Components · component Typeahead |
prop query?: string |
<Typeahead query={…} /> |
Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.
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/32 stories · Learn more - WCAG: 1.4.3 (Level AA)
- Rule:
Generated by PR Enrichment workflow | View full report
|
🤖 (Posted by Cindy's agent.) Thanks for the rebase and the fixes, @mvanhorn! CI is now running, and one lint step fails: "Check the comment-provenance baseline" reports that the baseline is out of date for the Typeahead and Tokenizer files this pull request touches ( To fix it, run
Thank you! |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the new public API, and three fixes are needed whatever that decision is.
The six new props (query and defaultQuery on Typeahead, Tokenizer and BaseTypeahead) and the behaviour they bring have no current spec record: the BaseTypeahead record keeps query text internal and has a pick clear it, and it keeps the text a field opens with package-internal. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, or by changing the records (the author may do so if they are an engineering owner), deciding a held query after a pick, an outside value set while the field is idle, a focused clear, a held query across a person's close of Tokenizer's sheet, and defaultQuery asking the source at mount.
- Found by CI: Lint fails on its comment-provenance check: the two comments that start with
INV3:inBaseTypeahead.tsx(lines 1700 and 1760) cite a record, so CI'slintjob fails; keep the sentences and drop theINV3:label (an earlier review asked for that wording). - Tokenizer's bottom sheet mishandles a controlled query: with
queryset, a keystroke the app does not take leaves the sheet's list busy with no search running, and a value the app sets while the sheet is open is never marked pending or announced (TokenizerBottomSheet.tsx:715-731starts both only from typing), so the sheet should follow the shownqueryvalue and get a test for each case. - Regression: The description's test counts are stale: the four named test files now run 503 tests at this head, not 473 (or 469), after the merge of
main.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Claim: six optional props are added next to
onChangeQuery— verified (generated API delta; CI's analysis lists the same six). - Claim: a set
queryshows that text andonChangeQueryreports every change the field makes — verified in the three components' tests. - Claim: holding
queryafter a pick keeps the text; following''empties it — verified (tests; Tokenizer inline reproduced locally). - Claim:
defaultQuerystarts the text and the field then owns it — verified (tests). - Claim: omitting both keeps today's behaviour — verified (the four suites pass locally and in CI).
- Claim: an outside set does not move focus, open the list or announce unless the field has focus — false in Tokenizer's sheet with focus in its search field (finding 2); verified inline and for the idle case.
- Claim: a focused clear does what emptying does, closing the list or showing focus entries — verified inline (test; reproduced locally with focus entries).
- Claim: an idle search keeps its answer for the next open with the list closed and nothing announced — verified (reproduced locally and in Chromium).
- Claim: an uncontrolled pick still empties the field;
defaultQueryshows without opening — verified (tests). - Claim: no theming attributes change — verified (no theme or attribute rows).
- Claim: first-load size growth of about +208 to +257 B — reported against an older base; measured locally at +181 to +265 B and in CI at +249 to +270 B, under the 0.3 KB allowance.
- Claim: 473 (and 469) tests passed in the named files — false at this head (finding 3).
- Claim: lint and format on touched files, with one pre-existing warning — reported; the warning is unchanged, but CI's
lintjob fails (finding 1). - Changeset: same claims as the description; the focused-announce clause is false for the sheet (finding 2); the changeset check passes.
- Files:
.changeset/…l7mf.mdfinding 2;Tokenizer.doc.mjsfinding 2;Tokenizer.test.tsxclear;Tokenizer.tsxfinding 2 (JSDoc);TokenizerBottomSheet.tsxfinding 2;BaseTypeahead.doc.mjsclear;BaseTypeahead.test.tsxclear;BaseTypeahead.tsxfinding 1;Typeahead.doc.mjsclear;Typeahead.tsxclear.
|
🤖 (Posted by Cindy's agent.) Thank you for the update, @mvanhorn! Before this goes to a maintainer decision, one implementation change is needed: the new layout effect in
The name |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the six new query and defaultQuery props, and three fixes are needed whatever that decision is.
No current spec covers a public controlled query on Typeahead, Tokenizer or BaseTypeahead: the BaseTypeahead record says the query text is internal and that a pick clears it. An engineering owner needs to decide whether these props ship and how the held-pick, idle-set, focused-clear, sheet-close and mount-search behaviours work, recording it with a /approve-spec <full head SHA> comment or a record change (the author can do this only as an engineering owner).
- Tokenizer's bottom sheet mishandles a controlled query: with
queryset, a keystroke the app does not accept leaves the sheet's list busy with a Loading spinner and no search running, and a value the app sets while the sheet is open is searched with no busy state and never announced (TokenizerBottomSheet.tsx:715-731), so start the pending state and search number from the shownqueryand add sheet tests for both cases. - The new query Effect does idle work that render and focus can do: as the maintainer asked, follow the unfocused case with the render-time previous-value pattern and search on the next open in
handleFocus, keeping a small Effect only for a value set while the field is focused (BaseTypeahead.tsx:1760-1775). - Regression: The description's test counts are stale: the four named test files run 503 tests at this head, not 473 or 469, so update or drop the count.
The comment-provenance lint failure from the last round is fixed, and CI passes at this head.
Claims and files checked
Review mode: full; reason: author-not-engowner
Claims:
- Title: a controlled API to set or clear the typed query is added: verified (API delta; controlled-query tests).
- Six optional props,
queryanddefaultQuery, on Typeahead, Tokenizer and BaseTypeahead: verified (built-surface comparison; CI's API report lists the same six). - Passing
queryshows that text andonChangeQueryreports the field's own changes, a pick and a clear included: verified (typing and pick tests; the clear button routes through the input change). - Holding
queryafter a pick keeps the text; following the empty report empties it: verified (held-pick and echo tests in Typeahead and Tokenizer). defaultQuerystarts the field with text it then owns: verified (default-query tests).- Omitting both keeps today's behaviour, and an uncontrolled pick still empties the field: verified (503 tests in the four suites, run here).
- An outside change moves no focus and, while the field is unfocused, opens nothing and announces no count: verified (idle test; Chromium capture with instant, debounced and slow sources).
- A focused clear closes the list, or shows the focus entries with
hasEntriesOnFocus: verified (focused-clear test; probe with focus entries, run here). - An idle search keeps its answer for the next open and the live region stays quiet: verified (Chromium capture: nothing announced while idle, the count once on focus).
valueandonChangeare unchanged and no theming attribute changes: verified (no theme or attribute rows in the API delta).- First-load size table: reported (measured here against this base: Typeahead +265 B, Tokenizer +264 B, BaseTypeahead +181 B; the four reference pages +0 B).
- Lint and format on touched files, with one pre-existing unused-import warning: reported, and matches the checks run here and CI's lint job.
- "473 tests passed" and "469 tests passed": false (the four files run 503 tests at this head).
- Public text carries no internal context: verified (no matches).
- Scope is Typeahead, Tokenizer and BaseTypeahead: verified (every API row is in scope).
- Changeset: the same claims as above (set or clear text, restore, keep after a pick, reports, no focus move or idle announcement,
defaultQuerystart): verified as above.
Files:
.changeset/typeahead-and-tokenizer-add-a-controlled-api-to--l7mf.md: clearpackages/core/src/Tokenizer/Tokenizer.doc.mjs: clearpackages/core/src/Tokenizer/Tokenizer.test.tsx: clearpackages/core/src/Tokenizer/Tokenizer.tsx: clearpackages/core/src/Tokenizer/TokenizerBottomSheet.tsx: finding (controlled query pending state)packages/core/src/Typeahead/BaseTypeahead.doc.mjs: clearpackages/core/src/Typeahead/BaseTypeahead.test.tsx: clearpackages/core/src/Typeahead/BaseTypeahead.tsx: finding (idle work in the new Effect)packages/core/src/Typeahead/Typeahead.doc.mjs: clearpackages/core/src/Typeahead/Typeahead.tsx: clear
|
|
||
| // Synchronize the `query` prop to the search source's timer and | ||
| // request, the popover layer, and the live region. | ||
| useIsomorphicLayoutEffect(() => { |
There was a problem hiding this comment.
The unfocused half of this Effect has a better home, as the maintainer suggested: follow the shown text during render with the previous-value pattern (DateInput/NativeDateField.tsx:412-415), and in handleFocus run handleQueryChange(query) when query !== lastSearchedQuery, the way the opening query already waits for the first open. Keep a small Effect only for a value the app sets while the field is focused, with a comment saying why no field event carries it. That drops idleSearchRef, isInputFocusedRef and heldQueryAfterPickRef, and defaultQuery no longer asks the source at mount.
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the six new query and defaultQuery props, and four fixes are needed whatever that decision is.
No current spec covers a public controlled query on Typeahead, Tokenizer or BaseTypeahead: the BaseTypeahead record says the query text is internal and that a pick clears it. An engineering owner needs to decide whether these props ship and how the held-pick, idle-set, focused-clear, sheet-close and mount-search behaviours work, recording it with a /approve-spec <full head SHA> comment or a record change (the author can do this only as an engineering owner).
- A keystroke the app rejects is still searched on the inline field: with
queryset, typing "5" after "Ap" in a field whose app strips digits searches "Ap5", empties the list and announces "Loading" under the unchanged "Ap" before searching "Ap" again (BaseTypeahead.tsx:1650-1665, reproduced in Chromium), so report the keystroke without searching it and search the shownquerywhen it changes, as the bottom sheet now does, with an inline test for a rejected keystroke. - The new query Effect does idle work that render and focus can do: as the maintainer asked, follow the unfocused case with the render-time previous-value pattern and search on the next open in
handleFocus, keeping a small Effect only for a value set while the field is focused (BaseTypeahead.tsx:1762-1775). TokenizerBottomSheet.test.tsxis not Prettier-formatted: the new FR20 test at lines 2696-2700 fails CI'slintjob, so runpnpm exec prettier --write packages/core/src/Tokenizer/TokenizerBottomSheet.test.tsx.- Regression: The description's test counts are stale: the four named test files run 505 tests at this head (run locally), not 473 or 469, so update or drop the count.
Non-blocking:
- One sheet comment runs 36 words in one sentence (
TokenizerBottomSheet.tsx:477-479); splitting it into three short sentences keeps the reason.
The bottom sheet's stuck Loading row after a rejected keystroke is fixed, and the new sheet tests cover both cases.
Claims and files checked
Review mode: full; reason: author-not-engowner
Claims:
- Title: a controlled API to set or clear the typed query is added: verified (API delta; controlled-query tests).
- Six optional props,
queryanddefaultQuery, on Typeahead, Tokenizer and BaseTypeahead, beside the existingonChangeQuery: verified (built-surface comparison; CI's API report lists the same six). - Passing
queryshows that text, andonChangeQuerykeeps reporting the field's own changes (typing, a pick, a clear, the sheet's close): verified (typing, pick and sheet tests). - Holding
queryafter a pick keeps the text; following the empty report empties it: verified (held-pick and echo tests in Typeahead and Tokenizer). defaultQuerystarts the field with text it then owns: verified (default-query tests).- Omitting both keeps today's behaviour, and an uncontrolled pick still empties the field: verified (all 505 tests in the four suites, run here).
- An outside change moves no focus and, while the field is unfocused, opens nothing and announces no count: verified (idle test; Chromium capture with a delayed source).
- A focused clear closes the list, or shows the focus entries with
hasEntriesOnFocus: verified (focused-clear test; probe with focus entries). - An idle search keeps its answer for the next open and the live region stays quiet: verified (Chromium capture: nothing announced while idle, the count once on focus).
- The controlled pair matches
isOpen/defaultIsOpenin other fields: verified (Collapsible has both). valueandonChangeare unchanged and no theming attribute changes: verified (no theme or attribute rows; themes' built surfaces unchanged).- First-load size table and its attribution to BaseTypeahead: reported (measured here against this base: Typeahead +265 B, Tokenizer +263 B, BaseTypeahead +181 B; Text, Heading, Button, IconButton, Link and Table unchanged; Tokenizer's own files add about 80 B beyond BaseTypeahead).
- Lint and format on touched files, with one pre-existing unused-import warning: reported; the unused import is pre-existing, but Prettier fails on one changed test file (finding).
- "473 tests passed" and "469 tests passed": false (the four files run 505 tests at this head).
- Scope is Typeahead, Tokenizer and BaseTypeahead, one capability, with docs and tests: verified (every API row is in scope; no unrelated change).
- Public text carries no internal context: verified (no matches).
- Changeset: set or clear the text, restore, clear from another control, keep after a pick, reports, no focus move or unfocused announcement,
defaultQuerystart: verified as above.
Files:
.changeset/typeahead-and-tokenizer-add-a-controlled-api-to--l7mf.md: clearpackages/core/src/Tokenizer/Tokenizer.doc.mjs: clearpackages/core/src/Tokenizer/Tokenizer.test.tsx: clearpackages/core/src/Tokenizer/Tokenizer.tsx: clearpackages/core/src/Tokenizer/TokenizerBottomSheet.test.tsx: finding (Prettier)packages/core/src/Tokenizer/TokenizerBottomSheet.tsx: non-blocking note (comment length); the controlled pending state now follows the shown querypackages/core/src/Typeahead/BaseTypeahead.doc.mjs: clearpackages/core/src/Typeahead/BaseTypeahead.test.tsx: clearpackages/core/src/Typeahead/BaseTypeahead.tsx: finding (rejected keystroke searched; idle work in the new Effect)packages/core/src/Typeahead/Typeahead.doc.mjs: clearpackages/core/src/Typeahead/Typeahead.tsx: clear
| droppedQueryRef.current = null; | ||
| onChangeQuery?.(newQuery); | ||
| if (origin === 'input') { | ||
| onChangeQuery?.(newQuery); |
There was a problem hiding this comment.
With query set, this path still schedules a search for the keystroke before the app answers (lines 1674-1740). When the app keeps the text (it strips a digit, caps the length), the field showing "Ap" searches "Ap5": it goes busy, announces "Loading", the empty answer replaces the rows, and only then is "Ap" searched again and "2 results" announced a second time (reproduced in Chromium and in a unit probe; the source is asked ["Ap", "Ap5", "Ap"]). For a controlled field, report the keystroke without searching it and search the query value the field shows when it changes, as the bottom sheet now does, and add an inline test for a rejected keystroke like the sheet's FR20 one.
| // Pending state and the search number follow the shown query rather than | ||
| // the keystroke, so a rejected controlled edit never leaves the list busy | ||
| // and a query the app sets while open shows busy feedback and announces. |
There was a problem hiding this comment.
Non-blocking (INV29): one 36-word sentence. Suggested: "Pending state and the search number follow the shown query, not the keystroke. A rejected controlled edit then leaves the list idle. A value the app sets while the sheet is open shows busy feedback and is announced."
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the six new query and defaultQuery props on Typeahead, Tokenizer and BaseTypeahead, and three fixes are needed whatever that decision is.
No current component record admits a public query: BaseTypeahead's record keeps the query text internal and gives the opening text no caller prop, and Tokenizer's record clears the query on every close the person makes, so an engineering owner needs to decide whether these components take the pair and how a controlled pick, an idle app-set value, a focused clear, a held query in Tokenizer's sheet and defaultQuery's search at mount should behave. An engineering owner records that decision by commenting /approve-spec <full head SHA> or by updating the records, and the author may do so if they are an engineering owner.
- A keystroke the app rejects is still searched on the inline field: with a controlled
querythat strips a digit, the field showing "Ap" searches "Ap5", goes busy, empties its list and says "Loading" twice before searching "Ap" again (reproduced locally and in a browser check). - The new query Effect does idle work that render and focus can do: follow the shown text with the render-time previous-value pattern and search on the next focus, keeping a small Effect only for a value set while the field is focused, as the maintainer asked.
- The description's test counts are stale: the four test files run 505 tests at this head, not 473 or 469.
- One sheet comment runs 37 words in one sentence: splitting
TokenizerBottomSheet.tsx:477-479into three short sentences would meet the comment style (non-blocking).
Claims and files checked
Review mode: full; reason: author-not-engowner
- Title: adds a controlled API to set or clear the typed query: verified (six added props; set and clear tests).
- Changeset and description: Typeahead and Tokenizer (and BaseTypeahead) take
queryanddefaultQueryso an app can set or clear the text: verified (built API surfaces compared; the set-query test runs on all three). - Pass
querywithonChangeQueryto restore, clear or keep the text after a pick: verified (held-pick tests; Tokenizer echo tests). onChangeQuerykeeps reporting every change the field makes, a pick and a clear included: verified (typing, pick, clear and sheet-close paths; the engine has two internal writes, both report).- An outside change does not move focus, open the list or announce a count unless the field has focus: verified (idle-set test; browser check: the live region stays empty until focus); in Tokenizer's open sheet focus stays inside the sheet when the count is announced.
- A focused clear closes the list, or shows the focus entries with
hasEntriesOnFocus: verified (focused-clear test; ahasEntriesOnFocusprobe lists the three focus entries). - Omitting both keeps today's internal text: verified (existing cases in the four suites pass).
defaultQueryshows without opening the list, and the field types after it: verified (two tests).- A controlled pick reports an empty query and keeps a held text; an uncontrolled pick still empties: verified (tests).
- An idle search keeps its answer for the next open with the list closed and the live region quiet: verified (browser check: closed and quiet, then the count once on focus).
- Neither component record names a public query pair: verified against the current records.
- No theming attributes change: verified (built surfaces: no theme rows).
- First-load size: Typeahead +235 B, Tokenizer +257 B, BaseTypeahead +208 B, other entries 0 B: reported; measured here +265 B, +263 B, +181 B and 0 B, all under the 0.3 KB limit.
- 473 tests passed in the four files, 469 at the re-run: false (505 tests run here).
- Lint and format on touched files, with one pre-existing unused-import warning: verified (CI's lint job passes at this head; ESLint run here shows warnings only, that one included).
- Scope checklist (one capability, no unrelated changes, docs and tests ship, no internal context): verified (only a test import path and an IME comment ride along; no internal context found).
Files:
.changeset/typeahead-and-tokenizer-add-a-controlled-api-to--l7mf.md: clearpackages/core/src/Tokenizer/Tokenizer.doc.mjs: clearpackages/core/src/Tokenizer/Tokenizer.test.tsx: clearpackages/core/src/Tokenizer/Tokenizer.tsx: clear (the held query in the sheet is part of the owner question)packages/core/src/Tokenizer/TokenizerBottomSheet.test.tsx: clearpackages/core/src/Tokenizer/TokenizerBottomSheet.tsx: one non-blocking comment notepackages/core/src/Typeahead/BaseTypeahead.doc.mjs: clearpackages/core/src/Typeahead/BaseTypeahead.test.tsx: clearpackages/core/src/Typeahead/BaseTypeahead.tsx: two blocking findingspackages/core/src/Typeahead/Typeahead.doc.mjs: clearpackages/core/src/Typeahead/Typeahead.tsx: clear
feat(Typeahead): add a controlled API to set or clear the typed query
Related to #8930
Animated replay of real captured command output, not a live UI recording. Live Testing Library capture at 3:24 AM PT, Fri Nov 13, 2026 (America/Los_Angeles). Re-run at 3:26 AM PT: 469 tests passed.
User need
An app can watch the typed search through
onChangeQuery, but it cannot set that text. Filters, restored sessions, and sibling controls need to put a query in the field, or empty it, without taking over selection (value/onChange). Today the text lives only in BaseTypeahead state, so those apps reimplement the input or fight a pick that clears it.A wrapper cannot fill the gap: the engine owns search, the listbox, and the announcements. The app needs the same controlled pair other Astryx fields already use.
Problem and solution fit
Add optional
queryanddefaultQueryon Typeahead, Tokenizer, and BaseTypeahead, next to the existingonChangeQuery.queryto show that text.onChangeQuerykeeps reporting every change, its own included, so a controlled field stays in sync.queryafter a pick to keep the text. FollowonChangeQuery('')to empty it.defaultQuerywhen the field should start with text and then own it.queryfrom outside does not move focus. It does not open the listbox or announce a result count unless the field has focus. Clearingquerywhile the field is focused does what emptying the field does: the listbox closes, or shows the focus entries withhasEntriesOnFocus.Current specification
component:BaseTypeaheadFR1 describes the input as internal query state whilevalueis caller-controlled, and a pick as clearing that query.component:Typeaheadrecordsvalueas the controlled selection. Neither record names a publicquery/defaultQuerypair.This pull request keeps that default: omit
queryand the field still owns the text, and an uncontrolled pick still empties it. The new props are additive. Owner review can admit them on those records.Related to #8930.
Public delta and caller burden
API
query?: string. When set, the field is controlled and shows this text.defaultQuery?: string. Initial text whenqueryis not set.onChangeQuerykeeps reporting every change, its own included, so a controlled field stays in sync.value/onChangeare unchanged: they are still the selected item or tokens.hasEntriesOnFocus.Caller decision: pass
querywithonChangeQueryto own the text. PassdefaultQueryto start with text the field then owns. Omit both to keep today's empty internal query.First-load size
Eager gzip per entry, base (
12a96e4) against head, measured with themeasureEntrybuild fromscripts/check-component-import-boundaries.mjs:The growth is the controlled-query wiring in the shared BaseTypeahead module.
Design and alternatives
querywith uncontrolleddefaultQuery. MatchesisOpen/defaultIsOpenand other Astryx fields. Chosen so an app can restore, clear, or keep text without a breaking default.valuefor the typed text. Rejected:valueis the selected item. Mixing selection and typing would break every existing callsite.A search the app starts while the field is idle reuses the dismissed-search path: the answer is kept for the next open, the listbox stays closed, and the live region stays quiet.
Evidence
queryshows on Typeahead, Tokenizer, and BaseTypeahead, and typing reports throughonChangeQuery.query=""and the field empties.hasEntriesOnFocus.''and keeps the text when the app holdsquery.defaultQueryshows without opening the listbox, and the field still types after it.Docs:
Typeahead.doc.mjs,Tokenizer.doc.mjs,BaseTypeahead.doc.mjs.Scope
Components: Typeahead, Tokenizer, BaseTypeahead
Testing
pnpm exec vitest run \ packages/core/src/Typeahead/BaseTypeahead.test.tsx \ packages/core/src/Typeahead/Typeahead.test.tsx \ packages/core/src/Tokenizer/Tokenizer.test.tsx \ packages/core/src/Tokenizer/TokenizerBottomSheet.test.tsx \ --project ui473 tests passed in those files (including the new controlled-query cases).
Lint/format on touched files. Pre-existing unused
composeEventHandlersimport warning inTypeahead.tsxis unchanged.State matrix: controlled vs
defaultQueryvs omit, set and clear from outside, idle vs focused, pick-sync (hold vs empty), Typeahead / Tokenizer / BaseTypeahead, listbox open/close, live-region result count.