Repository navigation
[Component Audit] CommandPaletteInput: expose accurate search semantics - #7321
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression44 of 460 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 24 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
Requesting changes: the searchbox default for standalone fields and the palette-owned combobox semantics are the right fix, and the tests and accessibility audit pass, but two things need attention before this lands.
- Popup props passed as
undefined(for examplearia-expanded={open || undefined}) are treated as absent, so a standalone field wired to its own popup flips betweensearchboxandcombobox, or reports a closed popup as expanded; treating a present key as caller-owned and passing its value through unchanged, with a toggling-popup test, would fix it. - The new
CommandPaletteInput.spec.mdand the ownership edit toCommandPalette.spec.mdneed the overlap search and boundary explanation the knowledge-contract rules ask for in the PR description, including how this coordinates with #6950, which edits the same lines and record.
[Automated review]
| const callerOwnsPopup = | ||
| !ctx && | ||
| (props.role === 'combobox' || | ||
| props['aria-expanded'] != null || | ||
| props['aria-autocomplete'] != null || | ||
| props['aria-controls'] != null || | ||
| props['aria-activedescendant'] != null); | ||
| const standaloneRole = | ||
| props.role ?? (callerOwnsPopup ? 'combobox' : 'searchbox'); |
There was a problem hiding this comment.
Caller ownership is inferred from non-null values, so a caller that passes its popup props as undefined while closed (for example aria-expanded={open || undefined} with aria-controls={open ? id : undefined}) gets role="searchbox" while closed and combobox once open. With an always-present aria-controls, aria-expanded={undefined} becomes "true". The released field kept combobox and omitted an explicitly undefined aria-expanded. Checking key presence ('aria-expanded' in props, and so on) and passing present values through unchanged keeps those callers stable; a test that toggles a caller popup would pin it.
| - Search orchestration and the current Input, List, Item, Group, Group heading, | ||
| Empty, and Footer parts and targets. | ||
| - The native Query field rendered inside the default Input. | ||
| - Composition of the native Query field rendered inside the default Input; the field's semantics and native passthrough are owned by `component:CommandPaletteInput`. |
There was a problem hiding this comment.
This moves the query field's semantics to a new record. Please add the overlap receipt the knowledge-contract rules ask for in the PR description — search terms, the canonical owner (this file), and overlapping open work such as #6950, which edits this record and the same CommandPaletteInput.tsx lines — and say why the standalone field needs its own record.
…ned even when undefined
…-audit/CommandPaletteInput/2026-10-11 # Conflicts: # packages/core/src/CommandPalette/CommandPalette.spec.md
There was a problem hiding this comment.
Approval of this pull request waits on a maintainer: the new draft CommandPaletteInput.spec.md adds requirements that no current spec states yet — standalone searchbox semantics with caller-owned combobox popups, palette-owned semantics over passthrough props, empty endContent handling, the placeholder-name order and the victim-free patch classification — and the pull request moves the query field's ownership out of CommandPalette.spec.md, so a maintainer needs to approve or reject those. Independently, please treat aria-owns and aria-haspopup (other than "false") as caller popup attributes too: today a standalone field wired to its own popup only through them changes from combobox to searchbox, which contradicts the new docs and the patch's victim-free premise, and a test like the toggling-popup case would pin it. Otherwise the runtime fix is well evidenced: the focused suites pass, the new semantics tests fail against the previous implementation, and the accessibility audit of both new stories reports no violations.
[Automated review]
| const callerOwnsPopup = | ||
| !ctx && | ||
| (props.role === 'combobox' || | ||
| callerSets('aria-expanded') || | ||
| callerSets('aria-autocomplete') || | ||
| callerSets('aria-controls') || | ||
| callerSets('aria-activedescendant')); |
There was a problem hiding this comment.
Caller popup detection lists only role="combobox" and these four keys, so a standalone field wired to its own popup only through aria-owns or aria-haspopup now renders searchbox, where the released field rendered combobox with aria-expanded="true" and aria-autocomplete="list". That contradicts the docs' "a combobox when popup relationships are supplied" and the patch's victim-free premise. Counting aria-haspopup (other than "false") and aria-owns here, with a test like the toggling-popup case, keeps those callers unchanged.
… popup attributes
There was a problem hiding this comment.
Approval of this pull request waits on a maintainer: the new draft CommandPaletteInput.spec.md adds requirements no current spec states yet — standalone searchbox semantics with caller-owned combobox popups, palette-owned semantics over passthrough props, empty endContent handling, the placeholder-name order and the victim-free patch classification — and the pull request moves the query field's semantics out of CommandPalette.spec.md, so a maintainer needs to approve or reject those. Separately, please extend the Changeset to name the old default (an expanded combobox), the new one (searchbox) and the prop that restores the old behavior (role="combobox"), as the release-compatibility spec asks for a semantic default change. The runtime change otherwise checks out on this head: fields wired to their own popup through aria-owns or aria-haspopup now stay a combobox, every caller-popup case we checked keeps its released output, and the focused tests, accessibility audit and CI pass.
- If AR3 is approved as written, note that a caller's
aria-haspopuporaria-ownsstill passes through inside the palette, so either the field owns those there too or AR3 names the attributes it owns.
[Automated review]
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] Give no-popup standalone command-palette fields searchbox semantics while preserving caller-owned popup roles and relationships, and preserve component-owned popup state when the field is connected to a command palette. |
There was a problem hiding this comment.
The release-compatibility spec asks a Changeset for a semantic default change to name the old and new default and the prop that restores the old one. Something like: "A standalone field with no popup attributes was role="combobox" with aria-expanded="true" and aria-autocomplete="list"; it is now role="searchbox" with no popup state. Pass role="combobox" (or your popup's own ARIA attributes) to keep the old semantics."
| a `combobox` with context-owned expanded state, list relationship, autocomplete | ||
| mode, and active descendant, following `spec:AST-020/FR1,FR2` and the WAI-ARIA | ||
| combobox pattern. | ||
| - **AR3 — Semantic ownership.** CommandPalette context overrides conflicting |
There was a problem hiding this comment.
As written, AR3 covers any conflicting passthrough, but inside the palette the field only owns role, aria-expanded, aria-autocomplete, aria-controls and aria-activedescendant; a caller's aria-haspopup (even false) or aria-owns still reaches the combobox unchanged. If AR3 is approved, either own those two in the palette branch too or name the attributes the field owns here.
… placeholder; accept the record - Default accessible name: aria-label, then label, then the translated "Search commands" (owner decision A146); placeholder text is never the name. - CommandPaletteInput.spec.md becomes current (approved by cixzhang 2026-10-14): ORD3/AR1 state the new name order, AR3 names the attributes the field owns inside CommandPalette, DEC-1 records the default name. - The Changeset names the old and new standalone semantics with role="combobox" as the way back, and the old and new default name with label as the way back. - Tests: default and custom-placeholder names, the contextual name, and AR3's owned versus passed-through attributes.
|
/approve-spec e4d341d |
There was a problem hiding this comment.
Requesting one small change: the semantics fix, the new default name and the CommandPaletteInput contract check out, the contract is owner-approved for this revision, and the new tests and CI pass. Because the field is now named "Search commands" unless a label is passed, the file-search examples that pass only placeholder="Search files..." are announced as "Search commands"; please add label="Search files" in packages/cli/assets/templates/blocks/components/CommandPalette/CommandPaletteAsyncSearch.tsx and in the file-search story in apps/storybook/stories/CommandPalette.stories.tsx.
[Automated review]
| const value = controlledValue ?? ctx?.search; | ||
| const handleValueChange = onValueChange ?? ctx?.setSearch; | ||
| const accessibleLabel = | ||
| props['aria-label'] ?? label ?? t('@astryx.commandPalette.input.label'); |
There was a problem hiding this comment.
With this default, the two file-search examples that pass only placeholder="Search files..." — packages/cli/assets/templates/blocks/components/CommandPalette/CommandPaletteAsyncSearch.tsx (line 42) and the file-search story in apps/storybook/stories/CommandPalette.stories.tsx (line 269) — are now announced as "Search commands". Passing label="Search files" at both keeps their names accurate, as this pull request's own docs advise.
The file-search block template and story passed only a placeholder, so with the new default they were announced as "Search commands". The Changeset names @astryxdesign/cli, which ships the template.
|
/approve-spec 36a95b8 |
There was a problem hiding this comment.
This looks ready to approve: the standalone searchbox semantics, the palette-owned combobox, the "Search commands" default name and the new CommandPaletteInput contract check out, the contract is owner-approved for this revision, and the file-search examples now pass label="Search files". The new tests fail against the released implementation and pass here, and CI is green. One optional follow-up: the record's compatibility line calls the standalone role change an AST-017 FR5 contract restoration while the Changeset rightly cites FR53, so aligning that wording would avoid a second reading.
[Automated review]
| - Released default preserved: `no` for no-popup standalone semantic output and | ||
| for the default accessible name; caller-owned popup associations and all other | ||
| CommandPalette output remain equivalent | ||
| - Compatibility class: contract restoration under `spec:AST-017/FR1,FR3,FR5` for |
There was a problem hiding this comment.
Optional: the released docs called this field "the combobox input", so the standalone role change replaces a documented role, and AST-017 FR5 says such a change "is not a fix, except an accessibility behavior fix under FR53". Classifying the standalone semantics under FR53, as the Changeset already does, would match the release outcome.
- CommandPaletteInput keeps #7321's standalone searchbox/combobox role and aria-label → label → "Search commands" name chain, and this pull request's listbox gating of aria-expanded, aria-controls, and aria-activedescendant inside the palette, plus the IME guard. - CommandPaletteInput.spec.md AR2 and states record the no-results state. - The Changeset drops its default-name bullet, now in #7321's, and names the Home/End, Page Up/Page Down, and empty-search announcement changes.
User impact
Standalone
CommandPaletteInputfields now expose searchbox semantics instead of claiming an expanded combobox with no popup. InsideCommandPalette, the query stays a combobox and its role, popup state, list relationship, autocomplete mode, and active descendant can no longer be overwritten by passthrough props. Screen-reader users hear "Search commands" (translated) as the field's name, or the caller'slabel, never the placeholder.Owner decision
The spec owner settled the default name and approved this pull request's
CommandPaletteInput.spec.mdon 2026-10-14: the default accessible name is a fixed, localizable "Search commands", and a placeholder is never the name ("Merge the specs", 19:31 PT; "Can you resolve the not merging specs", 19:33 PT, applying the recommended options). The record isauthority: current, and its DEC-1 records the default name.What changed
undefined, and a passed value reaches the field unchanged, so a field wired to its own toggling popup stays a combobox and an explicitly undefinedaria-expandedis omitted, as in the released field.aria-ownsand anyaria-haspopupother thanfalsealso count as caller popup attributes, so a field wired to its popup only through them stays a combobox;aria-haspopup="false"keeps a searchbox.0, inside the trailing layout group and omit empty React nodes.aria-label, thenlabel, then the translated "Search commands"; placeholder text is never the name.CommandPalettethe field ownsrole,aria-expanded,aria-autocomplete,aria-controls, andaria-activedescendant; other ARIA props, includingaria-haspopupandaria-owns, pass through (AR3 names them).CommandPaletteInput.spec.mdcomponent contract.Authority and compatibility
spec:AST-020/FR1,FR2, andspec:AST-056/AR2.architecture:public-component-api/INV5.spec:AST-017/FR1,FR3,FR5; callers that connect the standalone field to their own popup retain their role and ARIA relationships, so the no-popup correction has no released victim.spec:AST-017/FR53: no app code changes, and the Changeset names the old default (the placeholder), the new one ("Search commands"), andlabelas the way to keep a specific name. The standalone semantics change names the old default (an expandedcombobox), the new one (searchbox), androle="combobox"as the way back.onValueChange(value)whileonChange(event)carries the native event.Overlap and record boundary
CommandPaletteInput,command-palette-input, query field, searchbox, combobox,aria-expanded,aria-controls, native passthrough; over current records and open pull requests.component:CommandPalette(CommandPalette.spec.md), which listed the native query field among the parts it owns. This change narrows that line to composition and points the field's semantics and native passthrough atcomponent:CommandPaletteInput.CommandPaletteInputis exported and used on its own, with no CommandPalette context. Its standalone semantics (searchbox without a popup, caller-owned combobox with one) and its passthrough routing apply where no palette exists, so the aggregate record, whose scope is the composed palette and its popup context, cannot govern them. The aggregate keeps the popup context, composition, and the open query-field theming question.CommandPalette.spec.md(result-surface anatomy and keyboard rows) and the sameCommandPaletteInput.tsxlines: it gates the contextualaria-expanded,aria-controls, andaria-activedescendanton selectable results, guards IME composition keys, and gives the field a default name that does not come from the placeholder. It changes only the contextual branch; this pull request owns the standalone branch and keeps the contextual branch's values. Whichever lands second rebases: the contextual gating and IME guard carry over unchanged, and both pull requests now give the same default name from the same catalog key.CommandPalette.spec.mdfor Empty only; no shared lines.Audit score
Rubric: 1.16.6 · mode: Night Watch
Test plan
pnpm vitest run packages/core/src/CommandPalette/CommandPaletteInput.test.tsx packages/core/src/theme/themingTargets.test.ts— 451 passed.pnpm vitest run packages/core/src/CommandPaletteafter merging main — 109 passed, including a caller popup that togglesaria-expanded={open || undefined}and an explicitly undefinedaria-expanded; both fail against the previous head.pnpm vitest run packages/core/src/CommandPalette— 114 passed, including fields wired only througharia-owns,aria-haspopup="listbox", andaria-haspopup={true}(combobox) andaria-haspopupfalse (searchbox); the three combobox cases fail against the previous head.pnpm -F @astryxdesign/core build— passed.pnpm -F @astryxdesign/storybook build— passed.pnpm lint:strict— 0 errors; existing repository warnings only.pnpm check:knowledgeandpnpm check:changesets— passed.Full
pnpm testencountered unrelated CLI filesystem/time-limit failures under the concurrent local run; the deterministic failed CLI suites pass in isolation. Exact-head Actions remains authoritative.Browser, accessibility, RTL, and visual evidence: pending exact-head Actions. No local browser result is credited.
pnpm vitest run packages/core/src/CommandPaletteat this head — 116 passed. The default-name, custom-placeholder, and contextual-name tests fail when the name falls back to the placeholder.Writing rubric results
R1 narration: compatibility wording was rewritten as present-tense classification and guarantees.
R2 research: none.
R3 evidence: facts and standards, not changes.
R4 rejected alternatives: none.
R5 change references: none.
R6 open questions: OQ1 callback migration remains genuinely unanswered; the aggregate CommandPalette contract retains its existing query-field theming question.
Rerun over both records after merging main and resolving the
CommandPalette.spec.mdownership line: R1–R5 clean (no narration, research, change references, or pull-request links; scanned for the R1 terms and#+digits,/pull/,/issues/); R6 unchanged.Rerun for the default-name decision and the promotion to current (
CommandPaletteInput.spec.md): R1 ORD3, AR1, AR3, and the compatibility lines state present behavior; the "released fallback" and "known BLOCK" sentences are gone. R2 none. R3 none. R4 one, inside DEC-1, one line. R5 none. R6 OQ1 unchanged.