Repository navigation
fix(Typeahead): the result count names every match, not only the rows shown - #11629
Conversation
… shown A search that matched more items than maxMenuItems announced the capped row count. The announcement now adds the matches past the cap, on the settled, kept and failed paths. Tokenizer shares BaseTypeahead.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 978b666 |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Tokenizer · Storybook | 103.5 kB (+22 B) · 20.0 kB CSS (0) | 2,633 (+11) | ✓ · ✓ · ✓ |
| BaseTypeahead | 78.1 kB (+20 B) · 11.7 kB CSS (0) | — | ✓ · ✓ · ✓ |
| Typeahead | 87.5 kB (+20 B) · 13.3 kB CSS (0) | — | ✓ · ✓ · ✓ |
2 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| PowerSearch | 306.1 kB (+17 B) · 25.3 kB CSS (0) | — | — · — · — |
| TypeaheadItem | 6.6 kB (0) · 3.6 kB CSS (0) | — | ✓ · ✓ · ✓ |
Package size: @astryxdesign/core 7.52 MB packed (+453 B); no new dependencies.
Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested: the Typeahead count fix works, but the changeset's Tokenizer claim does not hold for Tokenizer's default sheet presentation.
- Tokenizer's default
adaptivepresentation opens the bottom sheet on compact touch screens, and the sheet still caps the source's results atmaxMenuItemsand announces that capped count (TokenizerBottomSheet.tsx:554,:811-815), so a 40-match search announces "40 results" in the inline field but "10 results" in the sheet; carry the count past the cap into the sheet (with its comment at:806-810and the test atTokenizerBottomSheet.test.tsx:982), or narrow the changeset and description to Typeahead and Tokenizer's inline presentation.
The new test fails on main and passes here, and the kept and failed paths announce every match too. Two small suggestions: assert the full '40 results' text at Typeahead.test.tsx:251, and drop the first sentence of the comment at BaseTypeahead.tsx:1232, which restates the variable name.
Claims and files checked
- Claim: Typeahead and Tokenizer announce every match when a search matches more than
maxMenuItems: true for Typeahead and Tokenizer's inline field, false for Tokenizer's sheet presentation - Claim: screen-reader users of Typeahead and Tokenizer are affected: as above
- Claim: on main a 40-match search showed 10 rows and announced "10 results": verified (the new test fails on main with that text)
- Claim: the announcement now names every match and the list still shows the first
maxMenuItemsrows: verified (new test) - Claim: the count covers the settled answer, an answer kept through a dismissal, and a failed search that keeps the last list: verified (
BaseTypeahead.tsx:1357,:1344,:1384, each path run) - Claim: Tokenizer shares the typeahead engine, so it gets the same fix: true for the inline field, false for the sheet presentation
- Claim: the existing result-count string is reused, with no new string and no API change: verified (same catalog key; no API rows added, changed or removed)
- Claim: a visible "showing 10 of 40" row or new wording is not part of the change: verified
- Claim: a fix changeset is included: verified (patch for core)
- Claim: the new test fails on main and passes here: verified
- Claim: the Typeahead, BaseTypeahead and Tokenizer suites pass: verified (13 files, 551 tests)
- Claim: the typeahead record's result-count requirement decides the behavior: verified, with an engineering owner's approval of this head
- Claim: the change is one component file, one test and a changeset, with no internal context in public text: verified
- Claim (commit message): the settled, kept and failed paths add the matches past the cap, and Tokenizer shares the engine: as above
- File
.changeset/typeahead-result-count-all-matches.md: finding (the Tokenizer claim) - File
packages/core/src/Typeahead/BaseTypeahead.tsx: clear (one comment suggestion) - File
packages/core/src/Typeahead/Typeahead.test.tsx: clear (one assertion suggestion)
…maxMenuItems The touch sheet capped its answer and announced only the rows it lists, so a search announced 40 inline and 10 in the sheet. It now keeps how many matches the cap hid and adds them, as the inline field does.
|
/approve-spec 34d838f |
There was a problem hiding this comment.
Changes requested: the Typeahead count and the inline Tokenizer count now name every match, but Tokenizer's sheet counts a selected match twice.
- Tokenizer's sheet lists every selected item that matches the query and also counts the matches its cap hid from the source's whole answer (
TokenizerBottomSheet.tsx:559,:817-821), so a selected match pastmaxMenuItemsis counted twice and 40 matches with one such selected item announce "41 results"; keep the hidden items instead of their number, count only those not already listed, and add a sheet test for that case. - The description's "So inline and sheet announce the same count" is false when a selected item matches the query, because the inline field leaves committed values out of its list and the sheet lists them (39 against 40 with one selected match); correct that sentence.
Smaller suggestions: assert the full '40 results' at Typeahead.test.tsx:251, and keep only the reason in the comments at BaseTypeahead.tsx:1232 and TokenizerBottomSheet.tsx:410. Miss: the changed comment at TokenizerBottomSheet.tsx:811-814 is one long verbless sentence; keep only its reason.
Claims and files checked
- Claim: screen-reader users of Typeahead and Tokenizer whose search matches more than
maxMenuItems(10 by default) are affected: verified - Claim: before, 40 matches showed 10 rows and announced "10 results": verified (the new Typeahead test fails on main with that text)
- Claim: after, the announcement names every match and the list still shows the first
maxMenuItemsrows: verified (new test: 40 results, 10 options) - Claim: BaseTypeahead adds the matches past the cap on the settled, kept and failed paths: verified (
BaseTypeahead.tsx:1357,:1344,:1384; each announces 40 for 40 matches when run) - Claim: Tokenizer's inline field gets the same fix: verified (40 results with nothing selected)
- Claim: the sheet keeps how many matches its cap hid and adds them to its count: verified, but it counts a selected match past the cap twice (finding)
- Claim: below
minQueryLengththe sheet adds none: verified (TokenizerBottomSheet.tsx:421) - Claim: inline and sheet announce the same count: false when a selected item matches the query (finding)
- Claim: the existing result-count string is reused, with no new string and no API change: verified (no public API rows added, changed or removed)
- Claim: a fix changeset is included: verified (patch for core)
- Claim: the new Typeahead test fails on main and passes here: verified
- Claim: the sheet test announces 4 on main and 5 here: verified
- Claim: the Typeahead, BaseTypeahead and Tokenizer suites pass: verified at this head (13 files, 551 tests)
- Claim: CI runs the sheet test: not yet, CI has not run on this draft head; the test passes when run directly
- Claim: the typeahead record's result-count requirement decides the behavior: verified, with an engineering owner's approval of this head
- Claim: a visible "showing 10 of 40" row or new wording is not part of the change: verified
- Claim: the change is BaseTypeahead and the Tokenizer sheet, their tests and a changeset, with no internal context in public text: verified
- Claim (changeset): Typeahead and Tokenizer name every match when a search matches more than
maxMenuItems: true, apart from the sheet's double count of a selected match past the cap - Claim (commit messages): the settled, kept and failed paths add the matches past the cap, and the sheet adds the matches its cap hid as the inline field does: as above
- File
.changeset/typeahead-result-count-all-matches.md: clear - File
packages/core/src/Tokenizer/TokenizerBottomSheet.tsx: finding (double count), two comment suggestions - File
packages/core/src/Tokenizer/TokenizerBottomSheet.test.tsx: clear; no case with a selected match past the cap - File
packages/core/src/Typeahead/BaseTypeahead.tsx: clear (one comment suggestion) - File
packages/core/src/Typeahead/Typeahead.test.tsx: clear (one assertion suggestion)
The sheet lists every selected item that matches the query, so a selected match past maxMenuItems was counted both as a row and as a hidden match. It now keeps the hidden items and counts only those it does not list.
|
/approve-spec a0859db |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet.
The sheet now counts a selected match past maxMenuItems once, and the description explains why the inline and sheet counts differ when a selected item matches.
Optional: the comment at TokenizerBottomSheet.tsx:815-818 still describes the old count (the sheet now adds only the hidden matches no row lists), and the kept-through-Escape and failed-search paths in BaseTypeahead have no test.
Claims and files checked
- Claim: screen-reader users of Typeahead and Tokenizer whose search matches more than
maxMenuItems(10 by default) are affected: verified - Claim: before, 40 matches showed 10 rows and announced "10 results": verified (the new Typeahead test fails on main with that text)
- Claim: after, the announcement names every match and the list still shows the first
maxMenuItemsrows: verified (40 results over 10 options) - Claim: a visible "showing 10 of 40" row or new wording is not part of the change: verified
- Claim: BaseTypeahead adds the matches past the cap on the settled, kept and failed paths: verified (
BaseTypeahead.tsx:1357,:1344,:1384) - Claim: Tokenizer's inline field gets the same fix: verified (40 results with nothing selected)
- Claim: the sheet adds the matches its cap hid: verified (40 results for 40 matches)
- Claim: below
minQueryLengththe sheet adds none: verified (TokenizerBottomSheet.tsx:421) - Claim: a hidden match the sheet already lists, such as a selected item, counts once: verified (
TokenizerBottomSheet.tsx:628-631; 40 for 40 matches with one or two selections past the cap) - Claim: with a selected match, the inline and sheet counts differ by the committed values: verified (39 inline, 40 in the sheet)
- Claim: the existing result-count string is reused, with no new string and no API change: verified (no public API rows added, changed or removed)
- Claim: a fix changeset is included: verified (patch for core)
- Claim: the new Typeahead test fails on main and passes here: verified
- Claim: the sheet cap test announces 4 on main and 5 here: verified
- Claim: the selected-match sheet test lists three rows and announces 5, not 6: verified (5 here, 6 on the previous revision, 3 on main)
- Claim: the Typeahead, BaseTypeahead and Tokenizer suites pass: verified at this head (13 files, 552 tests)
- Claim: CI runs the sheet test: not yet; CI has not run on this draft head, and the test passes when run directly
- Claim: the typeahead record's result-count requirement decides the behavior: verified, with an engineering owner's approval of this head
- Claim: the change is BaseTypeahead and the Tokenizer sheet, their tests and a changeset, with no internal context in public text: verified
- Claim (changeset): Typeahead and Tokenizer name every match when a search matches more than
maxMenuItems: verified - Claim (commit messages): the settled, kept and failed paths add the matches past the cap; the sheet adds the matches its cap hid; the sheet counts a hidden match it already lists once: verified
- File
.changeset/typeahead-result-count-all-matches.md: clear - File
packages/core/src/Tokenizer/TokenizerBottomSheet.tsx: clear (one comment suggestion) - File
packages/core/src/Tokenizer/TokenizerBottomSheet.test.tsx: clear - File
packages/core/src/Typeahead/BaseTypeahead.tsx: clear (kept and failed paths untested) - File
packages/core/src/Typeahead/Typeahead.test.tsx: clear
There was a problem hiding this comment.
Changes requested: the count fix works, but the two new tests do not typecheck, so CI's typecheck and build jobs fail on this head.
- Found by CI: the test sources at
packages/core/src/Typeahead/Typeahead.test.tsx:237andpackages/core/src/Tokenizer/TokenizerBottomSheet.test.tsx:1060leave outbootstrap, whichSearchSourcerequires, so typecheck reports TS2741 and TS2769 there; addbootstrap: () => []to each, as the other sources in those files do.
Optional: the comment at TokenizerBottomSheet.tsx:815-818 still describes the old count, and the kept-through-Escape and failed-search paths in BaseTypeahead have no test.
Claims and files checked
- Claim: screen-reader users of Typeahead and Tokenizer whose search matches more than
maxMenuItems(10 by default) are affected: verified - Claim: before, 40 matches showed 10 rows and announced "10 results": verified (the new Typeahead test fails on main with that text)
- Claim: after, the announcement names every match and the list still shows the first
maxMenuItemsrows: verified (40 results over 10 options) - Claim: a visible "showing 10 of 40" row or new wording is not part of the change: verified
- Claim: BaseTypeahead adds the matches past the cap when a query settles, when a dismissed answer is announced at the next open, and when a failed search keeps the last list: verified from the code (
BaseTypeahead.tsx:1356,:1343,:1383); the last two have no test - Claim: Tokenizer's inline field gets the same fix through BaseTypeahead: verified from the code
- Claim: the sheet keeps the matches its cap hid and adds them to its count: verified (
TokenizerBottomSheet.tsx:559,:821-824; the sheet cap test) - Claim: below
minQueryLengththe sheet adds none: verified (TokenizerBottomSheet.tsx:421) - Claim: a hidden match the sheet already lists, such as a selected item, counts once: verified (
TokenizerBottomSheet.tsx:628-631; the selected-match sheet test) - Claim: the inline field leaves committed values out of its list, so with a selected match the two counts differ by those values: verified from the code
- Claim: the existing result-count string is reused, with no new string and no API change: verified (no public API rows added, changed or removed)
- Claim: a fix changeset is included: verified (patch for core)
- Claim: the new Typeahead test fails on main and passes here: verified
- Claim: the sheet cap test announces 4 on main and 5 here: verified
- Claim: the selected-match sheet test lists three rows and announces 5, not 6: verified (5 over 3 rows here, 3 on main)
- Claim: the Typeahead, BaseTypeahead and Tokenizer suites pass: verified at this head (13 files, 552 tests)
- Claim: CI runs the sheet test: verified (CI's UI tests at this head ran and passed the sheet suite, the new test included)
- Claim: the typeahead record's result-count requirement decides the behaviour: verified, with an engineering owner's approval of this head
- Claim: the change is BaseTypeahead and the Tokenizer sheet, their tests and a changeset, with no internal context in public text: verified
- Claim (changeset): Typeahead and Tokenizer name every match when a search matches more than
maxMenuItems: verified - Claim (commit messages): the settled, kept and failed paths add the matches past the cap; the sheet adds the matches its cap hid; the sheet counts a hidden match it already lists once: verified
- File
.changeset/typeahead-result-count-all-matches.md: clear - File
packages/core/src/Tokenizer/TokenizerBottomSheet.tsx: clear (one comment suggestion) - File
packages/core/src/Tokenizer/TokenizerBottomSheet.test.tsx: blocking (the new test's source has nobootstrap, line 1060) - File
packages/core/src/Typeahead/BaseTypeahead.tsx: clear (kept and failed paths untested) - File
packages/core/src/Typeahead/Typeahead.test.tsx: blocking (the new test's source has nobootstrap, line 237)
…trap SearchSource requires bootstrap, so the two new test sources failed the typecheck. The sheet's count comment now says hidden matches it already lists count once.
|
/approve-spec 1565f0b |
There was a problem hiding this comment.
Approved: the full CI run on this head passed.
Searches that match more than maxMenuItems now announce every match ("40 results" over 10 rows), and Tokenizer's sheet counts each match its cap hides once; the three new count tests fail on main and pass here.
Optional: the sheet's count comment at packages/core/src/Tokenizer/TokenizerBottomSheet.tsx:815-818 can shrink to the rule it encodes (see the open inline suggestion), and the kept-through-Escape and failed-search paths in BaseTypeahead still have no test.
Claims and files checked
Review mode: same-head; reason: none
- Claim: screen-reader users of Typeahead and Tokenizer whose search matches more than
maxMenuItems(10 by default) are affected: verified (the cap defaults to 10, and both components announce throughBaseTypeaheador the sheet) - Claim: before, 40 matches showed 10 rows and announced "10 results": verified (the new Typeahead test fails on main with that text)
- Claim: after, the announcement names every match and the list still shows the first
maxMenuItemsrows: verified (40 results over 10 options,Typeahead.test.tsx:230-255) - Claim: a visible "showing 10 of 40" row or new wording is not part of the change: verified (no string or rendered change)
- Claim:
BaseTypeaheadadds the matches past the cap when a query settles, when a dismissed answer is announced at the next open, and when a failed search keeps the last list: verified from the code (BaseTypeahead.tsx:1356,:1343,:1383); the last two have no test - Claim: Tokenizer's inline field gets the same fix through
BaseTypeahead: verified (Tokenizer.tsx:2021-2030) - Claim: the sheet keeps the matches its cap hid and adds them to its count: verified (
TokenizerBottomSheet.tsx:559,:821-824; the sheet cap test) - Claim: below
minQueryLengththe sheet adds none: verified (TokenizerBottomSheet.tsx:421) - Claim: a hidden match the sheet already lists, such as a selected item, counts once: verified (
TokenizerBottomSheet.tsx:628-631; the selected-match sheet test) - Claim: the inline field leaves committed values out of its list, so with a selected match the two counts differ by those values: verified (
Tokenizer.tsx:1612-1635) - Claim: the existing result-count string is reused, with no new string and no API change: verified (no public API rows added, changed or removed)
- Claim: a fix changeset is included: verified (patch for core)
- Claim: the new Typeahead test fails on main and passes here: verified
- Claim: the sheet cap test announces 4 on main and 5 here: verified
- Claim: the selected-match sheet test lists three rows and announces 5, not 6: verified (5 over 3 rows here, 3 on main)
- Claim: the Typeahead, BaseTypeahead and Tokenizer suites pass: verified at this head (13 files, 552 tests); the earlier revision the description names was not re-run
- Claim: the sheet test change was left for CI to run: verified (CI's UI tests ran the sheet suite on this head and it passes)
- Claim: the typeahead record's result-count requirement decides the behaviour: verified, with an engineering owner's approval of this head
- Claim: the change is BaseTypeahead and the Tokenizer sheet, their tests and a changeset, with no internal context in public text: verified
- Claim: the land path is approval of this exact head, then CI and the merge queue: consistent (this review covers this head; CI passed on it)
- Claim: changeset: Typeahead and Tokenizer announce every match when a search matches more than
maxMenuItems: verified - Claim: commit messages (the settled, kept and failed paths; the sheet's hidden matches; the sheet's single count for a listed hidden match; the new test sources'
bootstrap): verified - Rule (changed): re-review scope from the rules changed since the last review: checked the two rule sets, no finding
- Rule (changed): same-head re-review: checked the head, its commits and this pull request's events since the last review, no finding
- Rule (changed): review mode line: checked this comment, no finding
- File
.changeset/typeahead-result-count-all-matches.md: clear - File
packages/core/src/Tokenizer/TokenizerBottomSheet.tsx: clear (one comment suggestion) - File
packages/core/src/Tokenizer/TokenizerBottomSheet.test.tsx: clear - File
packages/core/src/Typeahead/BaseTypeahead.tsx: clear (kept and failed paths untested) - File
packages/core/src/Typeahead/Typeahead.test.tsx: clear
| // selected items the source did not return, such as a created value, | ||
| // and the create row when it is offered — plus the matches the cap hid | ||
| // that the sheet does not already list. |
There was a problem hiding this comment.
Non-blocking (source-comment rule): this is now accurate, but it is one 44-word fragment that restates the sum below it. Keep only the rule:
// Each match counts once, listed or hidden by the cap. The create row
// counts too, as the inline field counts its create entry.
User impact
TypeaheadandTokenizerwhose search matches more items thanmaxMenuItems(10 by default).maxMenuItemsrows.Fixes the announced count in #11573. A visible "showing 10 of 40" row or new wording is not part of this change.
What changed
BaseTypeahead.tsx:showListrecords how many matches fall pastmaxMenuItemsin the list it shows, and the result count adds them. This covers:TokenizersharesBaseTypeahead, so its inline field gets the same fix.TokenizerBottomSheet.tsx(Tokenizer's touch sheet, the defaultadaptivepresentation on compact touch screens) keeps how many matches itsmaxMenuItemscap hid and adds them to its announced count. BelowminQueryLengthit adds none. A hidden match the sheet already lists, such as a selected item, counts once. The inline field leaves committed values out of its list, so with a selected match the two counts differ by those values; each count names what that presentation offers.@astryx.typeahead.resultCountstring is used. No new string, no API change.[fix]changeset.Evidence
Typeahead.test.tsx"announces every match, not only the rows maxMenuItems shows":TokenizerBottomSheet.test.tsx"announces the rows it lists plus the matches past maxMenuItems: a created value and a cap": 3 matches capped to 2, plus a created value and the create row. On main the sheet announces 4; here it announces 5, counting the hidden match.TokenizerBottomSheet.test.tsx"counts a selected match past maxMenuItems once": five matches,maxMenuItems2, and the fifth selected. The sheet lists three rows and announces 5, not 6.component:BaseTypeaheadAR4 (current) decides the behavior: "Each query announces the localized result count." A query that matched 40 has a result count of 40.Scope
Owner: Astryx fix-loop lane 0. Land path: CodeBunny approval of the exact head, Specs stamp, CI, then the merge queue.