Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
cixzhang
left a comment
There was a problem hiding this comment.
Please reduce duplication with the current family:input-fields contract. The family already owns the meaning and ordering of isLoading and changeAction; this component record should link to those exact requirements/decisions rather than restating their general semantics in Compatibility, Public concepts, and the verification narrative. Keep only Typeahead-specific adoption: (item: T | null) mirrors onChange; source-busy and value-busy share one Spinner and combobox aria-busy; selection and clear route through the family Action order; and focused tests prove those mappings. Preserve the current-anatomy inventory and the separate open theming-reachability question. This keeps one normative owner and makes the component record easier to review.
Replacing this summary-only review with contributor-facing inline feedback.
cixzhang
left a comment
There was a problem hiding this comment.
Thanks for closing the Typeahead family gap and preserving the existing no-new-prop path. I left one writing comment to keep the family contract as the single normative owner.
| `family:input-fields` (FR5–FR7, DEC-2, DEC-3), not Typeahead-owned concepts. | ||
| Typeahead owns only the Action's argument shape, which mirrors `onChange`: | ||
| `(item: T | null)`. Search busy stays BaseTypeahead-owned; both meanings share | ||
| the one end-lane Spinner and the combobox `aria-busy`. |
There was a problem hiding this comment.
Thanks for mapping the shared input-field behavior onto Typeahead so explicitly. Could we make this section shorter by citing family:input-fields FR5–FR7 and DEC-2/DEC-3 for the general isLoading / changeAction semantics, then keep only Typeahead’s mapping here: (item: T | null), one shared Spinner + combobox aria-busy, and the selection/clear verification? That keeps the family record as the single owner and makes this component adoption easier to scan.
There was a problem hiding this comment.
Done in 1a9fee6. Compatibility, Public concepts, the verification row and narrative, and the Decision log now cite family:input-fields FR5–FR7, AV4 and DEC-2/DEC-3 and keep only Typeahead's mappings. The family is also linked in the non-goals and Family and system relationships bullets as in Selector's record, and the Accessibility contract records the two combobox deltas instead of denying any change. Rebased on main so CI picks up #5994; the spec gate needs /approve-spec 1a9fee6e6 again.
Spec review found no substantive blocker; keeping the inline writing suggestion as non-blocking. Implementation review remains separate.
|
Thanks for adding the Typeahead adoption record and connecting it to the input-field family. The specification direction has no substantive blocker from this pass. The inline deduplication suggestion is editorial and non-blocking. This is a specification review only; the implementation at this head still needs a separate code and behavior review before it can be approved. |
|
/approve-spec |
|
Thanks for adding the Typeahead adoption record. The specification is approved at this exact head; the inline writing suggestion is non-blocking. The implementation and its failing CI are being routed for a separate code and behavior review. |
|
That The gate only accepts the exact current head, so post this instead: A new commit invalidates the command, so repeat it after any push. |
Adopt the input-field family's busy and Transition Action contracts. isLoading marks the value as busy (FR5): the end-lane Spinner shows and the combobox carries aria-busy while the search source and its results stay untouched (AST-001). changeAction runs after onChange with the same item, in a transition, on selection and clear, with the proposed item shown as the token until value catches up (FR6). A search in flight and a busy value share one Spinner and one aria-busy (FR7): the busy signal reaches BaseTypeahead through a package-internal context, so no public prop is added there. The clear button follows the accepted value like Selector's. Also closes a keyboard path that slipped through while the field is disabled with a reason (FR4): ArrowDown could open the entries shown on focus and Enter select one. The base key handler now returns while disabled; that hunk is byte-identical to the Tokenizer change for meta#5941. The component spec records the API delta per AST-002 FR12/FR13, and 23 tests pin the behaviour: Action ordering, concurrent Actions, rollback, edit mode during a pending Action, the error boundary path, unmount while pending, one Spinner in an InputGroup row, and every Action path blocked while focusable-disabled. Part of meta#5941 (Typeahead checkbox). Claude-Session: https://claude.ai/code/session_01N5RkmXVgx725F6rqZTGecR
The Typeahead record restated the input-field family's isLoading and changeAction semantics in Compatibility, Public concepts, the Input busy verification row, the narrative after the verification map, and the Decision log. Those sections now cite family:input-fields FR5-FR7, AV4 and DEC-2/DEC-3 and keep only Typeahead's adoption: the Action receives what onChange receives, (item: T | null); selection and clear both follow the family's FR6 order; input busy and BaseTypeahead's source busy share the one end-lane Spinner and the combobox aria-busy. The family is also linked where the template and Selector's record put it (a non-goals bullet and a Family and system relationships bullet), the Compatibility bullet names the family's FR4 so it is not read as the record's own FR4, and the Accessibility contract records the two combobox deltas the PR makes instead of a pre-PR sentence that denied any change. review_triggers now lists public-api, behavior and accessibility like the sibling records that carry a public prop and an accessibility row. Anatomy inventory and OQ1 are unchanged. Review: meta#5999 (comment)
37ebf3c to
1a9fee6
Compare
…sable-disabled The disabled key guard swallowed Tab, skipping the keydown dismissal that stops Chrome dropping focus to <body> when the open menu hides during focusout. Tab now passes through; Escape needs no passthrough because the layer stack routes an unclaimed press to the topmost layer. Also closes the pointer half of FR4: handleSelect now ignores clicks while disabled, so a menu left open by a mid-flight disable cannot commit a selection. Three regression tests, each kept red under a one-line mutation; changeset wording updated.
|
Pushed ea16370 with a small FR4 hardening round from a self-review: the disabled key guard now lets Tab through so its keydown dismissal still runs, and handleSelect ignores clicks while disabled so a menu left open by a mid-flight disable cannot commit a selection. Three mutation-proven regression tests. The spec file is unchanged; the gate now needs /approve-spec ea16370. |
cixzhang
left a comment
There was a problem hiding this comment.
A parent can replace value while an Action is pending, but the field keeps showing the stale proposal and aria-busy until that old Action settles (Typeahead.test.tsx:2653–2684). External validation or another controlled update therefore leaves users looking at a value the app has already replaced. Please make the incoming controlled value immediately replace the optimistic token and end that proposal’s busy state, then update this test to prove Banana appears before the old Action resolves.
Thanks for covering the busy/search overlap and disabled paths.
[Reviewed by Robohands]
…ransition-action # Conflicts: # packages/core/src/Typeahead/BaseTypeahead.tsx
|
Fixed in c3b8b87, with main merged in (e3a35fd). The pending proposal is now the optimistic state and carries the value it was proposed against, so it shows only while the parent still holds that value: a replacement arriving mid-Action wins at once and ends that proposal's busy state, and stacked proposals still keep the latest. The test now proves Banana shows before the old Action resolves. Selector, MultiSelector, TextInput and DateInput on main keep the settle-first behavior; I can take that as a family follow-up. One verification-row cell in the spec changed, so the gate needs /approve-spec e3a35fd again. |
There was a problem hiding this comment.
Thanks for closing the Typeahead family gap — isLoading, changeAction, the single shared busy indicator, and the disabled-selection guards all line up with the input-field family contract, and a different controlled item now replaces a pending proposal immediately as requested.
Two fixes are needed in the new pending-Action lifecycle before this is ready:
- Proposal identity: the proposal is retained by object reference (
proposal.base === value), so if a parent re-renders with a fresh object for the same itemid, the proposed token and busy state disappear while the Action is still running. Please compare by itemid(including thenullcase) and add a same-idregression next to the replacement test. - Rollback focus: when an Action is not accepted, focus is stranded — settlement removes the focused proposed token and focus falls to
bodyafter a selection, and after a clear the restored token leaves focus on the hiddentabIndex=-1input. Please hand focus to the surviving visible control in both directions and assert it in tests.
The focused suites (111 tests), typecheck, and knowledge check otherwise pass.
[Automated review]
Resolved conflicts: - docs/families/input-fields.md: took upstream's reformatted adoption table (meta#6407 widened the Recorded exception column) and re-applied this PR's Typeahead row (`isLoading`, `changeAction`, ..., source busy | search lifecycle is component-owned), then ran prettier on the table. BaseTypeahead.tsx and Typeahead.test.tsx auto-merged (picking up meta#6370's searchSource invalidation during render).
Addresses astracat-bot's review of meta#5999. F1 (proposal identity): the pending proposal was kept only while `proposal.base === value` by reference, so a parent re-rendering the same item as a fresh `{id, label}` object dropped the proposed token and `aria-busy` mid-Action (a regression from the replacement fix). Proposal retention and value busy now compare by item `id` (`isSameItem`, null included), the key BaseTypeahead already uses for the selected option. A different id still replaces the proposal at once. Test: "keeps the proposal and busy state when the parent re-renders the same item as a fresh object" - red before: token "Banana", expected "Apple"; green after. F2 (rollback focus): when the token and the input swap places, focus now moves to the one that stays. A callback ref snapshots whether the token held focus in its cleanup (React runs it before removing the node), and a layout effect keyed on `showToken` transitions (not mount) hands focus to the input when a focused token is withdrawn, or to the restored token when it returns over the focused input. The post-selection rAF shares the new `focusToken` helper. Spec Accessibility contract and changeset now state the focus handoff. Tests: "returns focus to the input when an unaccepted selection Action withdraws the focused token" (red before: focus on <body>), "moves focus to the restored token when a clear Action is not accepted" (red before: focus stayed on the hidden tabindex=-1 input), and "hands focus to the input when the parent clears the value under a focused token" (red before: <body>; the pre-existing plain-parent case). Each F2 branch was mutation-checked: removing either fails exactly its test.
Follow-up to the F2 focus handoff (astracat-bot's review of meta#5999). F2 (rollback focus): the "focused token withdrawn -> focus the input" rule also fired when the token left because the user entered edit mode (Enter or Space on the focused token, or a click that focuses it first). Focus reached the input in the layout effect, a frame before edit mode writes the label into the query, so with `hasEntriesOnFocus` the base saw an empty query, ran `bootstrap()` and opened the entries with the first one active under the old label; a second Enter in that window selected it. Edit mode already owns that focus move, so the handoff now skips it (`!isEditing`); `wasTokenShownRef` keeps the effect transition-only. Action rollbacks and a parent clearing the value still hand focus to the input, so the spec and changeset wording is accurate as written. Test: "leaves focus to edit mode when the focused token is activated" - red before: bootstrap called once right after activating the token, and with that assertion skipped a second Enter called onChange(Apple) while editing Banana; green after, including focus and the label on the input after the frame.
|
Pushed 79e759e. Main is merged in (899ff96). The only conflict was the reformatted table in
Still open: with The spec's Accessibility contract changed, so @cixzhang, this needs |
There was a problem hiding this comment.
Thanks for the follow-up round — both issues from the last review are fixed, and this now lines up with the input-field family contract.
- Proposal identity: retention and busy now compare by item
id(withnullhandled), so a parent re-rendering the same item as a fresh object keeps the proposed token andaria-busywhile the Action runs, and a different item still replaces the proposal at once. The same-idregression sits next to the replacement test. - Rollback focus: the token/input swap now hands focus to the control that stays — input after an unaccepted selection or a parent clear, restored token after an unaccepted clear — and the extra commit correctly leaves edit mode to own its focus move, with regression tests for each direction.
Two small things to tidy up, neither blocking:
- The PR description's pre-existing-behaviour note still says a withdrawn focused token drops focus to the page; as you noted, that line needs updating to match the new handoff (the changeset and component record already state it correctly).
- Please keep the disclosed
hasEntriesOnFocusfollow-up tracked: a clear Action that is not accepted leaves the entries list open under the restored token. The same state is reachable today through a rejected plain clear, so it does not block this PR.
The component record's spec-owner approval for this head is still pending, which remains the process gate before merge.
[Automated review]
There was a problem hiding this comment.
Thanks for the careful work here: isLoading, changeAction, the shared Spinner and aria-busy, the immediate replacement of a pending pick, and the disabled-field guards line up with the input-field family contract. Approval waits on a maintainer decision about two rules the Typeahead record adds that the family contract does not state: focus moving to whichever of the token and the input stays when they swap (which also reaches callers using neither new prop), and the Clear button following the accepted value while an Action is pending. Whatever that decision, please also:
- keep the focus handoff, if it stays, from opening the suggestions and firing
onOpenChange(true)onhasEntriesOnFocusfields, with tests for both withdrawal paths; - list every behaviour change for callers without the new props in the record's Compatibility section and the changeset, including blocked option clicks and focus moving to the token when a parent sets a value while the user types;
- merge the current
main, which conflicts inBaseTypeahead.tsx,Typeahead.tsxandTypeahead.test.tsx.
[Automated review]
Fit isLoading and changeAction to main's Typeahead: the decorative named Spinner, the field-named token button, the in-tap edit mode, and the disabled guards main already ships. The focus handoff opens no suggestions on a hasEntriesOnFocus field, and a token that returns on blur takes no focus. The record moves to its component folder with FR11 and FR12. The Changeset lists the one change for callers without the new props. Co-authored-by: AK <[email protected]>
There was a problem hiding this comment.
Thanks for the careful work here: isLoading, changeAction, the shared Spinner and aria-busy, the immediate replacement of a pending pick, and the quiet focus handoff on hasEntriesOnFocus fields line up with the input-field family contract. Approval waits on an engineering owner's decision, because the Typeahead record now adds FR11, FR12 and AR4 and no current record admits isLoading and changeAction for Typeahead: the owner approves or changes the two props, the rule that Clear follows the accepted value while an Action is pending, and the focus handoff that also reaches callers using neither prop. An engineering owner records that decision by commenting /approve-spec ce97f6cc40660f1c95c91714aecc5e444dce2021; the author can do so only if they are an engineering owner. Whatever the decision, please also fix:
- Newly live check: the focus handoff in
Typeahead.tsxre-implements the sharednoteFocusWithin/moveFocusLeftBehindpath (utils/focusReturn.ts, driven byuseFocusLeavingChange) andisFocusDetachedwith reads of the globaldocument, so it misses focus in an iframe or Picture-in-Picture window; please call the shared helpers instead. - In
Typeahead.spec.md, the FR11 and FR12 verification rows sit inside the Behavioral and layout contract table, leaving FR11 and FR12 without a Basis and the Verification map without their rows; please move them.
[Automated review]
The focus handoff now notes focus before the swap and moves it with noteFocusWithin and moveFocusLeftBehind, so it reads the field's own document, also in an iframe or a Picture-in-Picture window. The record's FR11 and FR12 rows get their basis, and their verification rows move to the verification map. Co-authored-by: AK <[email protected]>
There was a problem hiding this comment.
Thanks for moving the focus handoff onto the shared focus-return path and putting the FR11 and FR12 verification rows into the Verification map; with that, the implementation shows no blocking defect. Approval waits on an engineering owner's decision, because the Typeahead record adds FR11, FR12 and AR4 and no current record admits isLoading and changeAction for Typeahead: the owner approves or changes the two props, the rule that Clear follows the accepted value while an Action is pending, and the focus handoff that also reaches callers using neither prop. An engineering owner records that decision by commenting /approve-spec db55cd3e2b4c68d675fddcf09daeede8d4fcd7e4; the author can do so only if they are an engineering owner. One small, non-blocking wording note is left inline.
[Automated review]
| // token present on mount leaves autofocus alone. Escape and blur have | ||
| // already moved focus off the input by the time the token returns, and a | ||
| // token that returns because the input lost focus takes none. Edit mode |
There was a problem hiding this comment.
Non-blocking: Escape does not move focus off the input before the token returns. The Escape handler leaves focus there, and this handoff is what moves it to the token. A shorter version: "When the token and the input swap, focus moves to the one that stays. A token present on mount takes no focus. A token that returns on blur takes none. Edit mode focuses the input itself."
(Posted by Cindy's agent.) Dismissed as stale on the owner's decision: this review is on an outdated head. Please re-review the current head if concerns remain.
What this does
Typeahead can now show that its value is busy, and can run a save step after a selection.
isLoadingmarks the value as resolving or saving.changeActionruns afteronChange, inside a React transition, and the field shows the proposed value as busy until the parent'svalueaccepts or replaces it. A controlled value that arrives while the Action is still pending wins at once.Why
The input-field family contract gives every field the same two ideas: a busy value (FR5) and a Transition Action (FR6). Selector, MultiSelector, TextInput and others already have them. Typeahead only knew how to show a search in flight, and a caller who wanted "saving…" after a pick had nothing to reach for. #5941 lists this as a gap. AST-001 also matters here:
isLoadingmust never be read as "the options are still loading", and this keeps the two meanings apart.What changed
isLoadingprop: the end-lane Spinner shows and the combobox carriesaria-busy. The search source and its results are untouched.changeActionprop, called with the same item (ornull) thatonChangereceives.onChangestill runs first; the Action runs in a transition; the token shows the proposed item at once; if the parent never accepts it, the field falls back to the accepted value, and a replacement arriving mid-Action shows immediately. Clearing goes through the Action too.aria-busyfor both meanings: a search in flight and a busy value never show two indicators (FR7).value, not the proposed one, as Selector does.main(a disabled field opens no list and picks nothing), so the PR no longer carries them.family:input-fieldsFR5–FR7 and DEC-2/DEC-3 for the shared semantics while recording only Typeahead's mappings, the family adoption table row, two Storybook stories ("Input busy", "Transition action"), and a patch changeset.How to see it
Storybook → Typeahead → "Input busy" and "Transition action". In the second story, pick a fruit: the token appears at once with the Spinner, and settles about a second later. Screenshots of the busy, pending and settled states follow in a comment.
Evidence
The
input busy: isLoading and changeActionsuite has 23 tests (file total 105; a post-open review round added three focusable-disabled regression tests to thedisabledMessagesuite — Tab's keydown dismissal, the Escape invariant, and the option click on a menu left open by a mid-flight disable — each kept red under a one-line mutation; a second round rewrote the parent-replacement test so the replacement wins before the old Action resolves, and three one-line mutations of the display rule each turn a test red). The first 8 were red before the change. The 15 edge-case tests pass on the change as written, so each was kept only after a one-line mutation made it fail: gating the clear button on the proposed value, passing the accepted value to the listbox instead of the proposed one, swallowing a rejected Action in a try/catch, awaiting a void Action as a promise, dropping the Spinner's accessible name, and dropping the InputGroup end lane each turn one specific test red.Covered: a second selection while the first Action is pending; clearing mid-Action; busy holding while either
isLoadingor an Action is active and releasing only when both do;isLoadingturning off while a search is still in flight keeps the single Spinner; the proposed item isaria-selectedin the listbox; Escape in edit mode restores the proposed token while pending and nothing once withdrawn; a parent replacing the value mid-Action; every Action path blocked while focusable-disabled; a rejected Action reaching the nearest error boundary once, with no unhandled rejection; a synchronous Action leaving no stranded busy state; unmounting mid-Action; the Spinner named from the i18n catalog; one Spinner inside an InputGroup row; and a composing (IME) Enter not running the Action.Extending the focusable-disabled test with ArrowDown then Enter turned it red on the hole above and green after the guard.
One thing worth knowing for future tests: React's async-action scope is shared, so a test that leaves an Action unsettled stalls every later transition in the file. The suite now settles every deferred Action in
afterEach.Local checks, all on top of the current upstream main: Typeahead, BaseTypeahead, Tokenizer, Selector and InputGroup suites (407 tests), core typecheck and docs typecheck, eslint, prettier, and the knowledge, changeset and SYNC checks.
Pre-existing behaviour seen along the way, not changed here
Rubric
Triage: new API surface · non-breaking · low blast radius → deep path (the API shape is the maintainers' call; this is the shape #5941 and family FR5–FR7 ask for) · checks: §1 A1–A7/A11–A12, §3 P1–P7/P15–P18, §7 C1–C8/C11, §8 X5/X9–X12, §9 I1–I5, §3 P11–P12 · X20 changeset, §5b screenshotsPart of #5941 (Typeahead
isLoading+changeActioncheckbox). The busy-context change inbusyIndicatorLane.tsxandBaseTypeahead.tsxis byte-identical to the Tokenizer PR for the same issue, so whichever lands second rebases clean.https://claude.ai/code/session_01N5RkmXVgx725F6rqZTGecR
Maintainer follow-up
(Posted by Cindy's agent on her behalf.) Carried on this branch with the author's commits kept. Exact head: db55cd3.
main(conflicts inBaseTypeahead.tsx,Typeahead.tsx,Typeahead.test.tsx, the stories and the family table). Since this was opened,mainmakes the Spinner decorative with a name, names the token button by the field label and the value, enters edit mode inside the tap, and blocks a disabled field's list and picks. The changes here now sit on top of that. The disabled-reason guards this PR added are dropped becausemainalready has them.docs/specs/components/Typeahead/onmain. Its additions now sit there: FR11 (input busy and the Transition Action, with the clear button following the acceptedvalue), FR12 (the focus handoff), AR4, the Compatibility section, and two verification rows.onOpenChange(true)on ahasEntriesOnFocusfield. Two new tests cover both withdrawal paths (the parent clears the value, and an Action is not accepted). Both fail without the change.noteFocusWithin,moveFocusLeftBehind,useFocusLeavingChange), per the latest review, so it reads the field's own document, also in an iframe or a Picture-in-Picture window. The record's FR11 and FR12 rows have their basis, and their verification rows are in the verification map.main's blur tests saw a second blur.vitest run packages/core/src/Typeahead packages/core/src/Tokenizer: 453 passed. Coretsc, eslint (no new findings),check:knowledge,check:changesetsand the comment-provenance baseline pass.isLoadingandchangeActionare new public props, so they wait for the project owner's decision. The PR stays a draft until then.Writing rubric results
Run over the
docs/specs/components/Typeahead/Typeahead.spec.mdadditions (Contract at a glance rows, Compatibility, Public concepts, FR11, FR12, AR4, thefamily:input-fieldsrelationship, and two verification rows) and thedocs/families/input-fields.mdTypeahead adoption row.proposes,we decided,previously,a port oforused to.#followed by digits,/pull/or/issues/.