Repository navigation
feat(core): make Tokenizer InputGroup-compatible - #4405
Conversation
Items 1, 2 and 4 of the issue already shipped — the compatible/incompatible lists are documented and the other seven controls all consume `InputGroupContext`. Tokenizer was the one candidate left with zero `InputGroup` references, so this closes that gap using the recipe the issue's acceptance criteria state verbatim, mirroring `Typeahead`. Inside a group the Tokenizer stops rendering its own `Field`, so the group owns the single label, description and status chrome. The inner input is named by the group label plus the Tokenizer's own, composed through `getInputARIA` so `aria-describedby` merges the group's description with the input-local disabled reason instead of clobbering it, and the control adopts the shared `groupStyles.inGroup` border/radius so it joins the seam. One behaviour decision worth a maintainer's eye: `InputGroup` is a fixed-height single-line surface, but Tokenizer wraps by default, so wrapped tokens would render outside the group's border. The grouped variant therefore keeps tokens on one scrolling row. Letting it overflow the border, clipping tokens away, or making the group auto-height all seemed worse — but this enforces a contract rather than reading one. Refs meta#3520
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Tokenizer · Storybook | 🔴 99.3 kB (+4.5 kB) · 19.1 kB CSS (+301 B) | 2,536 (+197) | ✓ · ✓ · ✓ |
| PowerSearch | 294.0 kB (+972 B) · 24.5 kB CSS (+262 B) | — | — · — · — |
| InputGroup | 58.3 kB (0) · 7.9 kB CSS (0) | — | ✓ · ✓ · ✓ |
1 more component
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| InputGroupText | 6.7 kB (0) · 3.9 kB CSS (0) | — | ✓ · ✓ · ✓ |
Package size: @astryxdesign/core 7.31 MB packed (+6.1 kB); no new dependencies.
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
CI impact: 0 job-min per update · pool 0% · time to green +3.4 min · standard runners · 1 CI action or script file changed (not measured) ⚠️
| Before | After | Change | |
|---|---|---|---|
| Job-minutes per PR update | 85.8 | 85.8 | 0 |
| Runner pool, runner-minutes a day | 41,048 | 41,048 | 0 (0%) |
| Average concurrent jobs | 28.5 | 28.5 | 0 |
| Time to green (median → this run) | 19.1 min | 22.5 min | +3.4 min |
| Runs a day | 478 | 478 | 0 |
Not measured (the jobs that use these keep their recent minutes above): .github/scripts/story-play-guard.js.
Flags: time to green +3.4 min.
Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.
Accessibility: 2 violation(s)
Accessibility Audit
Status: 2 accessibility violation(s) found — 2 serious.
InputGroup - 1 issue(s)
- 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
- Rule:
color-contrast· Affects 1/25 stories · Learn more - WCAG: 1.4.3 (Level AA)
- Rule:
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
…nputgroup # Conflicts: # packages/core/src/Tokenizer/Tokenizer.tsx
cixzhang
left a comment
There was a problem hiding this comment.
This still lets builders create a grouped field that escapes its row or exposes contradictory validation, so I’m requesting changes. The default grouped row is now single-line, and standalone matched the merge-base pixel-for-pixel.
- Complete grouped adaptation: an
lgTokenizer inside ansmgroup renders 36px inside a 28px row, while localdescription/statusleave two deadaria-describedbyIDs and paint a warning border beside the group’s error state (Tokenizer.tsx:451,721,800). - Replace both render-time
mergeRefs(...)calls with stable merged refs; strict lint is red at lines 774 and 898. - Rebase onto current
main, preserving both its busy-lane reserve and this PR’sariaLabelledBy; the branch currently conflicts inTokenizer.tsx.
Please add focused grouped tests for mismatched sizes and local metadata.
[Reviewed by Robohands]
There was a problem hiding this comment.
Thanks for wiring Tokenizer into InputGroup — the group-owned field chrome, composed label/description, seam styling and single-line grouped row follow the linked compatibility recipe, and the focused ARIA/removal tests are a good base.
Requesting changes on three grouped-state issues:
- Mismatched sizes escape the row: a
Tokenizerwith a larger explicitsizethan the group keeps its largerminHeightinside the group's fixed-height row. Let the group size govern in group mode and add a mismatched-size test. - Local
description/statusare dead and contradictory in a group: noFieldrenders them, but their IDs still land inaria-describedby, and the local status border still paints beside the group's status. Suppress the local IDs and status styling when grouped (keeping the disabled-reason reference) and add grouped tests with local metadata set. - Unstable refs fail lint: both render-time
mergeRefs(...)calls should use the stableuseMergedRefshook, asTypeaheaddoes.
Please also resolve the current merge conflict on rebase. Rendered evidence for an overflowing multi-token grouped state would still help reviewers check the single-line seam once these are fixed.
[Automated review]
Resolved conflicts: - packages/core/src/Tokenizer/Tokenizer.tsx: took main's BusyIndicatorLaneProvider-wrapped BaseTypeahead (with the busy-lane `laneReserve` in inputXStyle, meta#5555) and re-applied this PR's `ariaLabelledBy={ariaLabelledBy}` prop to it.
Addresses the 2026-09-09 maintainer review and the astracat review on meta#4405. Each change has a grouped regression test in Tokenizer.test.tsx that failed before the fix and passes after it. - F1 (mismatched sizes escape the row): a grouped Tokenizer now resolves its size from the group (`useSize(inputGroup ? undefined : sizeProp)`), so the control, tokens, and end lane all follow the group row. Red: an `lg` Tokenizer in an `sm` group rendered `data-size="lg"`. A standalone `lg` control still reports `lg`. The `size` JSDoc, Tokenizer.doc.mjs, and the changeset say the group size applies. - F2 (dead and contradictory local metadata): in a group the local description/status IDs are no longer added to `aria-describedby`, and the local status border/hover/focus styling and theme `status` are dropped on the row, the layer placeholder, and the layer content. The disabled-reason reference stays. Red: describedby carried 2 IDs that resolve to nothing, and the row carried `data-status="warning"` beside the group's error. Covered for `none` and `unfocusedLayer` overflow, and with a disabled reason. - F3 (unstable merged refs fail lint): both render-time `mergeRefs(...)` calls are now `useMergedRefs`, hoisted above the layer-mode branch. Red: `@astryx/no-unstable-merged-refs` errors at 843:12 and 981:16, plus the grouped forwarded ref detaching (null) and re-attaching on every re-render. After: eslint is clean and the ref is not re-called. - F5 (rendered overflow evidence): the new InputGroup story WithTokenizerOverflow shows six tokens in a 320px group, where the row stays single-line and scrolls, and an explicit `lg` Tokenizer inside an `sm` group. Visual regression will capture both. F4 (the merge conflict) is resolved in the preceding merge commit.
cixzhang
left a comment
There was a problem hiding this comment.
(Approved by Cindy's agent; her OK at 726dad0 carries to this head.) Reviewed at 69c8d83: the only changes since 726dad0 are the four review fixes (a token's remove button works with one press in an overflowing row, the strip's name uses the Tokenizer's own label, two lint fixes, and the input-fields record now matches FR30). Thank you, @AKnassa!
There was a problem hiding this comment.
Requesting changes: the four points from the last review are fixed (one press on an early token's remove button now removes it, the disabled strip is named by the Tokenizer's label, the browser spec and comments pass lint, and the input-fields record lists Tokenizer as InputGroup-compatible), and the grouped stories render well in the browser, but one CI gate is red.
- Found by CI:
pr-a11y (audit and guards)fails on a new serious color-contrast violation inWithTokenizerOverflowDisabled(disabled token text at 1.83:1), because mergingmaintook its.github/a11y-baseline.jsonand dropped this branch'sInputGroup::With Tokenizer Overflow Disabled::color-contrastkey, so please re-add it beside the standaloneTokenizer::Disabledentries (for example withpnpm a11y:baseline -- --components InputGroup).
The Tokenizer, InputGroup and input-fields record changes are approved at this head. Two small non-blocking notes are inline.
[Automated review]
| // In a grouped row, a move to the input also scrolls the strip to its | ||
| // end before the press releases, so a press on a token's remove | ||
| // button keeps its focus too. |
There was a problem hiding this comment.
Non-blocking: this sentence runs to 32 words. A shorter version that keeps the reason: "In a grouped row, focus on the input scrolls the strip to its end. So a pointer press inside the strip keeps its focus."
| @@ -256,6 +258,7 @@ holds only `endContent` (FR17). | |||
| | FR26 | One open sheet edits one draft. The draft starts as `value` when the sheet opens and takes every row toggle, create, and Clear all (FR19, FR22, FR24); `value` and `onChange` are untouched while the sheet is open. Save closes the sheet; with an unchanged draft it reports nothing, and with a changed one it reports the whole draft once through `onChange(items, change)`, where `change` names the last edit that still holds: the last toggle, create, or clear when its item is in the draft and was not selected at open (`add`, or `create` for an item created in this sheet) or was selected at open and is not in the draft (`remove`); otherwise, when the last edit was a removal and some item selected at open is gone, a `remove` naming one such item; otherwise an `add` (`create` when the last edit created that item) naming an item in the draft that was not selected at open; otherwise a `remove` naming an item gone since open. A field that is disabled when Save fires reports nothing. A toggle is announced when it happens (AR6), not again on Save. | DEC-4 | Verified current behavior. | | |||
| | FR27 | Swipe, scrim, and Escape dismissal of the sheet close it directly while the draft equals the selection at open. While the draft differs, they open a discard confirmation inside the sheet — "Discard changes?", "Your changes to {label} haven't been saved." — with Discard changes as the destructive action and Keep editing as the safe one, which is focused first; Discard changes closes the sheet without reporting the draft, and Keep editing closes the confirmation and moves focus to the search field so editing resumes where the sheet's own reading order starts (`spec:AST-085/FR4`). The sheet's confirmations (this one and Clear all's, FR24) are one modal dialog shape: a title, a description, and two full-width large actions stacked in reading order — the destructive action, then the safe action, which takes focus first; the two actions are one action group (`family:action-groups`) while keeping their separated, full-width, stacked look; scrim and Escape take the safe action. A close the field forces (becoming disabled, FR17) asks nothing and reports nothing: the draft is dropped. | DEC-4 | Verified current behavior, with one implementation gap: the confirmation's two actions are separated Buttons, not yet one action group (`family:action-groups`). | | |||
| | FR28 | In the inline presentation, `menu`, `onOpenChange` and the handle's `open()` and `close()` reach BaseTypeahead, so the menu's listbox and dialog roles, its open handle and its focus return follow `component:BaseTypeahead` FR13–FR16. A token press that calls `open()` with a dialog-role menu opens the dialog, and Escape returns focus to that token: focus a press puts on a token's own control, and the menu's focus return, stay there instead of moving to the input. The sheet presentation keeps its own sheet: it ignores `open()` and `close()`, and `menu` or `onOpenChange` draws its development warning. | `component:BaseTypeahead` FR13–FR16 | Verified current behavior | | |||
| | FR30 | Inside an InputGroup, Tokenizer adopts grouped mode under `family:input-fields` FR3. It takes the group's size, height and disabled state; omits its own Field, border, radius and surface; is named and described by the group label and description plus its own (`component:InputGroup` FR2/AR2); and keeps its tokens on one row that scrolls inline, with edge fades where content is hidden. Every token and the input stay reachable by keyboard, and a focused token scrolls into view. Standalone Tokenizer is unchanged. | `family:input-fields` FR3; `component:InputGroup` FR2, FR6 | | | |||
There was a problem hiding this comment.
Non-blocking: this row's Status cell is empty, unlike every other FR row, and so is the FR30 verification row's audit cell (line 515).
…ntry The main merge took main's baseline file and dropped this branch's entry for the disabled grouped Tokenizer story. The entry returns unchanged, beside the standalone disabled Tokenizer's. Co-authored-by: AK <[email protected]>
|
/approve-spec acf41e4 |
There was a problem hiding this comment.
Changes requested for one description fix; the code and the record changes look ready.
- Miss: the description needs a
## Writing rubric resultssection covering the three records this pull request changes (component:Tokenizer,component:InputGroupandfamily:input-fields), because the knowledge-contracts record asks every record-changing pull request to report its R1–R7 results, and editing the description adds no commit, so the approval at this head stands.
Before merge, pr-a11y (audit and guards) also has to go green: its story play guard fails 26 Layer stories this pull request does not touch, the same checks fail on the base, and main fixed them in #11040, so merging main should clear it. The baseline entry restored in the last commit fixes the earlier audit failure. In the browser, the grouped WithTokenizer and WithTokenizerOverflow stories render as one row at the group's size, with a fade over hidden tokens, and standalone Tokenizer is unchanged.
[Automated review]
|
/approve-spec c6c2d5c |
There was a problem hiding this comment.
Approved: Tokenizer now joins an InputGroup as one grouped field, with the group's label, size, disabled state and seam and its tokens on one row that scrolls beside the end controls, while standalone Tokenizer is unchanged. The writing-rubric results in the description close the last open point, and CI is green at this head.
In the browser, WithTokenizer and WithTokenizerOverflow render as one 32 px row at the group's size (28 px with sm tokens in the sm group) with a fade on the side that hides tokens, where the base drew a second bordered field that grew past the group. Optional polish is listed in the review: the FR30 row's empty Status cell, its "Standalone Tokenizer is unchanged" sentence, which describes the change rather than the component, and several new source comments over the 25-word limit.
[Automated review]
|
/approve-spec c6c2d5c |
Resolves the Tokenizer record's verification table: main's FR13-FR15 row and this branch's FR30 row both stay. Co-authored-by: AK <[email protected]>
|
/approve-spec 71de60d |
There was a problem hiding this comment.
Approved: Tokenizer now joins an InputGroup as one grouped field, with the group's label, size, disabled state and seam, and its tokens on one row that scrolls beside the clear button and end content. Standalone Tokenizer renders as before.
Every record change has an engineering owner's approval at this head, CI is green, and the grouped stories (WithTokenizer, WithTokenizerOverflow, the end-controls and disabled stories) were checked in a real browser against the base.
Optional polish, none blocking:
- A few new comments in
Tokenizer.tsxrun past 25 words a sentence (for example lines 1088–1093 and 1467–1474), and the FR30 rows inTokenizer.spec.mdleave their Status and audit cells empty.
What this does
Tokenizer now works inside an
InputGroupinstead of rendering its own duplicate label and field chrome. It is admitted as a grouped member under the input-fields family's admission rule.What changed
Fieldof its own: the group owns the single label, description and status. The input is named by the group label plus Tokenizer's own (and a calleraria-labelledby), and described by the group's description and status plus its disabled reason.size, a disabled group disables it, and its localdescriptionandstatusare neither referenced nor painted.endContent, busy indicator), never under them.component:TokenizerFR30 and its verification row;component:InputGroupFR6 and the FR2/AR2 verification row list Tokenizer as an admitted member.WithTokenizer,WithTokenizerOverflow,WithTokenizerOverflowEndControls(with RTL) andWithTokenizerOverflowDisabled, plus a cross-browser strip contract (TokenizerGroupScroll.a11y.browser.spec.ts).Review outcomes at 726dad0
sizeescapes the group rowdescriptionandstatusleave deadaria-describedbyIDs and paint a second status borderaria-invalideither.mergeRefs(...)useMergedRefs, as main uses.refand DOM props to the input,control*to the grouped row:dir(rtl).The earlier single-line question is settled by the input-fields admission rule, and the grouped stories are the rendered evidence for the single-line seam.
Accessibility baseline
The
InputGroup::With Tokenizer Overflow Disabled::color-contrasta11y-baseline entry covers only that story's disabled Tokenizers (both haveisDisabled); WCAG 1.4.3 exempts inactive controls from contrast, matching the standaloneTokenizer::Disabledentries.Writing rubric results
Records changed:
component:Tokenizer(FR30 and its verification row),component:InputGroup(FR6 and the FR2/AR2 verification row), andfamily:input-fields(the Tokenizer row of the current shipped facts and the Tokenizer state-geometry note).family:input-fieldsFR3,component:InputGroupFR2 and FR6), and its verification row cites tests and stories, not changes.component:TokenizerFR30 instead.family:input-fieldsFR3.isLoadingorchangeAction).Refs #3520
(Posted by Cindy's agent on her behalf.)