Repository navigation
[Component Audit] CommandPaletteItem: preserve option activation and identity - #7324
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 Regression25 of 460 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 5 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
Automated review found nothing blocking: both runtime corrections restore CommandPaletteItem's documented disabled and passthrough behavior, and the new test for each fails without the fix and passes with it. No changes are requested. The standalone keyboard contract and selected-plus-highlighted paint stay with the open questions already recorded in this PR.
[Automated review]
Preserve the caller-provided list id outside CommandPalette while keeping the context-managed id authoritative for aria-controls. Keep the standalone list regression test and narrow the changeset to this remaining fix; the Item correction has already landed in meta#7324.
## User impact
`CommandPaletteList` accepts the native `id` prop through `BaseProps`, but drops it when rendered outside a `CommandPalette`. Consumer selectors and caller-owned ARIA relationships therefore cannot target the supplied identifier in the supported standalone form.
## Problem and solution fit
The list forwards its remaining DOM props and then assigns `id={ctx?.listId}`. Without a command-palette context, that later `undefined` overwrites the forwarded consumer ID.
Use `ctx?.listId ?? props.id` so the standalone list preserves the supplied ID. Inside a composed `CommandPalette`, the context-managed list ID remains authoritative and the query field's `aria-controls` relationship is unchanged.
## Expected behavior and authority
The [current public component API contract, INV5](https://github.com/facebook/astryx/blob/17306ce7a4a3a50161065a2d8347ebe6d44d390c/docs/architecture/public-component-api.md#boundaries-and-invariants) requires accepted consumer DOM props to reach the element that owns the contract while protecting component-owned accessibility behavior. `CommandPaletteListProps` already extends `BaseProps`; no new prop, type, or usage pattern is introduced.
## Smallest restoration
- Preserve the consumer `id` on standalone `CommandPaletteList`.
- Retain the existing standalone regression test and the composed query-field/listbox relationship coverage.
- Narrow the patch changeset to `CommandPaletteList`.
The `CommandPaletteItem` correction from the original version of this PR has already landed in #7324. This branch is rebased onto current main and removes the overlapping Item implementation and test changes. The remaining List correction is also identified as owned by this PR in #7370.
No search, selection, keyboard, styling, ref, role, label, managed ARIA, or file-header changes are included.
## Evidence
```tsx
<CommandPaletteList id="command-results">
<CommandPaletteItem value="settings">Open settings</CommandPaletteItem>
</CommandPaletteList>
```
- **Before:** the rendered listbox has no `id`. Temporarily restoring `id={ctx?.listId}` makes the standalone regression test fail because `getAttribute('id')` returns `null`.
- **After:** the supplied ID reaches the listbox. The complete CommandPalette directory passes **91 tests across eight files**.
- **Representative unchanged path:** the existing composition test verifies that the query field's `aria-controls` still equals the rendered listbox ID inside `CommandPalette`.
## Scope
- [x] One standalone List ID-forwarding defect is restored.
- [x] Item changes already merged in #7324 are excluded.
- [x] No new public API, visual representation, default, or interaction model is introduced.
- [x] Public text and artifacts contain no internal Meta context.
## Testing
- [x] `pnpm exec vitest run --project ui packages/core/src/CommandPalette` — **91 passed**, eight files.
- [x] `pnpm -F @astryxdesign/core typecheck` — passed.
- [x] Strict ESLint on the two changed TypeScript files — passed.
- [x] Prettier check on all three changed files — passed.
- [x] `pnpm check:repo` — passed, including knowledge, changeset, and sync checks.
- [x] `pnpm build` — passed.
- [x] Commit hooks — staged-file formatting and `pnpm check:repo` passed.
- [x] Repository strict ESLint excluding one existing Git-ignored local generated bundle — **0 errors, 105 warnings**. The unmodified `pnpm lint:strict` also scans that local bundle and fails on it; no lint configuration change is included.
User impact
Disabled command options no longer fire product click callbacks. Standalone items also retain caller-provided DOM identity, so labels, automation, and integrations can address the option they rendered without changing CommandPalette-managed active-descendant IDs.
What changed
isDisabled; enabled consumer cancellation still stops local selection, context selection, and close.id, ref, data/ARIA props, classes, styles, and the stable theme target on standalone items while retaining context-owned option semantics.Authority and compatibility
architecture:public-component-api/INV5,INV7.spec:AST-020/FR1,FR2,architecture:interaction-modality, and WAI-ARIA 1.2 option semantics. Buttons and links are not nested insiderole="option"because their semantics become presentational.[fix]underspec:AST-017/FR1,FR3,FR5;isDisabledalready promises non-interaction andBasePropsalready promises standalone native passthrough.idcorrection overlaps prior Item work by korkt-kim; coauthor and release-note credit are preserved while the separate CommandPaletteList correction remains out of scope.Audit score
Rubric: 1.16.6 · mode: Night Watch
Test plan
pnpm vitest run packages/core/src/CommandPalette/CommandPaletteItem.test.tsx packages/core/src/CommandPalette/CommandPalette.test.tsx packages/core/src/theme/themingTargets.test.ts— 464 passed.pnpm -F @astryxdesign/core build— passed.pnpm -F @astryxdesign/storybook build— passed.pnpm check:knowledge,pnpm check:changesets, andpnpm check:sync— passed.pnpm test— the broad concurrent local run produced 52 existing CLI/filesystem/time-limit failures; focused component, parent, and theming suites pass. Exact-head Actions remains authoritative.Writing rubric results