Repository navigation
[Component Audit] Item: a theme can restyle highlighted, selected, and disabled rows - #10073
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| ContextMenuItem | 25.8 kB (+38 B) · 6.1 kB CSS (0) | — | — · — · — |
| DropdownMenuItem | 20.3 kB (+31 B) · 6.0 kB CSS (0) | — | — · — · — |
| Pagination | 93.1 kB (+29 B) · 16.6 kB CSS (0) | — | — · — · — |
23 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| ContextMenu | 82.9 kB (+28 B) · 16.3 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 71.5 kB (+27 B) · 11.3 kB CSS (0) | — | — · — · — |
| DropdownMenuCheckboxItem | 21.1 kB (+27 B) · 6.4 kB CSS (0) | — | — · — · — |
| RadioListItem | 56.8 kB (+27 B) · 9.5 kB CSS (0) | — | — · — · — |
| SelectorOption | 19.3 kB (+27 B) · 5.8 kB CSS (0) | — | — · — · — |
| DropdownMenu | 77.8 kB (+26 B) · 16.4 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 59.7 kB (+26 B) · 9.3 kB CSS (0) | — | — · — · — |
| ListItem | 58.7 kB (+26 B) · 10.7 kB CSS (0) | — | — · — · — |
| DropdownMenuRadioItem | 21.1 kB (+25 B) · 6.4 kB CSS (0) | — | — · — · — |
| MoreMenu | 78.1 kB (+25 B) · 16.4 kB CSS (0) | — | — · — · — |
| PowerSearch | 260.0 kB (+25 B) · 22.6 kB CSS (0) | — | — · — · — |
| TableCell | 84.1 kB (+25 B) · 16.7 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 87.0 kB (+25 B) · 1.9 kB CSS (0) | — | — · — · — |
| lab/TransferList | 79.9 kB (+24 B) · 1.7 kB CSS (0) | — | — · — · — |
| Selector | 83.1 kB (+23 B) · 16.2 kB CSS (0) | — | — · — · — |
| Table | 92.3 kB (+23 B) · 16.9 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 59.7 kB (+22 B) · 10.7 kB CSS (0) | — | — · — · — |
| Markdown | 153.6 kB (+22 B) · 19.2 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 268.5 kB (+22 B) · 2.4 kB CSS (0) | — | — · — · — |
| Item · Storybook | 15.9 kB (+21 B) · 5.3 kB CSS (0) | 1,688 (+6) | ✓ · ✓ · — |
| TableHeaderCell | 83.7 kB (+21 B) · 16.5 kB CSS (0) | — | — · — · — |
| lab/Comments | 273.6 kB (+20 B) · 2.5 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 234.0 kB (+20 B) · 454 B CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 6.57 MB packed (+145 B); no new dependencies.
API changes: core +0 · ~4 · −0
Committed API report behind this build: cli 9 rows, core 8 rows; run pnpm api:report.
4 API changes (advisory)
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| ~ | core |
Theme targets · target item (Item) |
target item (Item) props [align, density] → target item (Item) props [align, density] states [disabled, highlighted, selected] |
defineTheme({components: {'item': {…}}}) |
| ~ | core |
Public attributes · attr data-disabled |
attr data-disabled (theme reflection on 30 targets) → attr data-disabled (theme reflection on 31 targets) |
[data-disabled] { … } |
| ~ | core |
Public attributes · attr data-highlighted |
attr data-highlighted (theme reflection on 1 target) → attr data-highlighted (theme reflection on 2 targets) |
[data-highlighted] { … } |
| ~ | core |
Public attributes · attr data-selected |
attr data-selected (theme reflection on 14 targets) → attr data-selected (theme reflection on 15 targets) |
[data-selected] { … } |
Touched components checked; add ci:run-visual to run the full suite.
Generated by PR Enrichment workflow | View full report
…he pointer onto the disabled row, and read the focus width from the theme; resolve private self-review findings
… tested, and the clamped label is proven in a browser
…and the clamped frame proves its fixture runs past two lines
There was a problem hiding this comment.
Changes requested, for wording only. The item target change itself follows the theming rule that a component reflects its state on its own target, and the new test fails before the fix and passes after it.
- The changeset (
.changeset/item-theme-states.md) and the PR description say rows that compose Item, such as list, menu and option rows, get all three states, but each row reflects only the states it passes to Item (ListItemgetsselectedanddisabled, menu, radio-list and checkbox-list rows get onlydisabled,SelectorOptiongets none, and no Core row setshighlighted), so please reword both to say which rows reflect which states.
Heavy CI has not run on this revision yet.
[Automated review]
There was a problem hiding this comment.
Approved pending CI: CI found no room for this head ("CI is full"), so its build and test jobs have not run; re-running the CI jobs will run them.
The item theme target now reflects highlighted, selected and disabled rows, as the theming rule that state stays on the component's own target asks, and the new test fails before the fix and passes after it. The changeset and description now say which composing rows reflect which states, which resolves the earlier request.
[Automated review]
…ch a story case may set
…s direction wrapper
There was a problem hiding this comment.
Approved pending CI: the required CI jobs are still running on this head.
The item theme target now reflects highlighted, selected and disabled rows, as the theming rule that state stays on the component's own target asks, and the new test fails before the fix and passes after it. The audit spec's direction fix since the last review is correct: its browser checks pass on this head, including the right-to-left case in the first-line story.
[Automated review]
User impact
Theme authors can now restyle a highlighted, selected, or disabled row. Item painted those states (the active row of a menu or a picker, the chosen row, an unavailable row) but did not reflect them on its
itemtheme target, so a theme could reach a row's density and alignment but not its state. The row now carriesdata-highlighted,data-selected, anddata-disabledon the target, the same names CommandPaletteItem uses. A row that composes Item reflects the states it passes to Item: for example, ListItem reflects selected and disabled, and DropdownMenuItem reflects disabled. Nothing changes for people using a row: no style, behavior, or accessibility change.Builders get Item docs that match the source:
refhas the root element's type (the root followsas, so it is not always adiv),classNameandstyleare listed, andxstylehas its standard description.The rest of Item is unchanged and now proven in a browser: a new
Statesstory and fail-closed Chromium receipts cover each state's paint and attributes, the keyboard focus ring, hover on an enabled and a disabled row, density padding, first-line alignment, and a 320px viewport, in light, dark, Butter, and RTL.Audit result
core/Item(released in@astryxdesign/coreunder./Item)1.16.6f384e62f5c4606e053e1aa562fdb0779c566750ca5ea981c642b5588b363fe98d4e06cff849d4e60Item.spec.md(authority: current), unchanged. The record governs alignment (FR1 to FR8) and touch press (FR9); its FR7 "no new state" is about thealignaxis. Row state on the theme target is governed byarchitecture:component-theming-surfaceINV6. No observational backfill was prepared; the closed evidence inventory below maps the rest of the public surface.themeProps('item', …)call. No style, default, or behavior change; the root gains data attributes only.:has(:focus-visible), nativedisabled, selection asaria-currenton a role-less rowitemtarget (INV6)spec:AST-057)not measuredMeasured weight is 96 of 100 before (§5b not measured) and 100 after. §11 is not run for an existing core component.
Why the score moved: §5b is measured at 4 (Needs Review 1); the theme-target fix closes the §2 BLOCK (3→5) and lifts the C cap; the truncation test and the browser receipts close the §6 and §10 FIXes; the doc fixes close three §8 FIXes
Pre-fix score: scored from base source before any change. Night Watch records only the landed post-fix result in the score ledger, so the pre-fix score lives here.
Findings fixed
isHighlighted,isSelected, andisDisabledselect Item's style objects, but theitemtarget reflected onlydensityandalign, so a theme could not reach a row's statearchitecture:component-theming-surfaceINV6 ("selection, disabled, and interaction state are reflected as target capabilities throughthemeProps")themeProps('item', {density, align, highlighted, selected, disabled})with the'name' : nullpattern of CommandPaletteItem and SegmentedControlItem;states: ['highlighted', 'selected', 'disabled']in the theming docs. Red, then green: the newItem.test.tsxcase fails at base ("Expected the element to have attribute") and passes with the fix; the theming guard passeslabelLinesanddescriptionLineshad no test anywherearchitecture:component-test-sufficiencyItem.test.tsxcase: one-line truncation on node content (which wraps by default) and the resolved clamp counts 3 and 2. It fails when the clamp count is dropped, whenlabelLinesis ignored, when the multi-lineoverflowis dropped, and when the one-line ellipsis is dropped. TheAlignFirstLineclamped frame proves two visible lines over a fixture that runs past twodesign:bidirectionalityItemAudit.a11y.chromium.spec.tsand the newStatesstory (no visual-baseline tag, so the stable visual plan does not change)refasReact.Ref<HTMLDivElement>; the source isReact.Ref<HTMLElement>, since the root followsasclassNameandstylehad no doc entryarchitecture:public-component-apiINV15xstyleused a non-standard descriptionNeeds Review
ease-out.spec:AST-057FR7 records this as an implementation gap, and open draft refactor(Item): swipe actions run on the interactive-transition driver #8344 moves the gesture to the shared transition driver. Not scored here.onClickignores clicks on native controls only; open pull request fix(Item): the row's onClick ignores clicks from portals and role-based controls #9393 extends that. Not scored here.styles.selectedandstyles.highlightedset a flat background after the interaction overlay, so a selected interactive row shows no hover or mouse-press overlay.design:user-statesdoes not list Item in its pressed matrix, so no current record decides this.--color-accent-muted,rgb(241, 241, 241)) and a highlighted row (--color-overlay-hover, 5% black) look almost the same; in Neutral dark,--color-accent-muted(rgb(38, 38, 38)) equals the surface, so a selected row shows no fill (framesstates-neutral-light,states-neutral-dark). Butter paints a distinct blue. The pair lives in the theme tokens, so it is not scored against Item; it affects every component that paints selection with--color-accent-mutedin Neutral.forced-colors: active; the row keepsaria-current. No current repository record sets forced-colors requirements for Item (SegmentedControl usesHighlight), so this is recorded, not scored.Item.spec.mdcould name the reflected states beside its alignment axis in a later owner-approved record change.Evidence
f384e62:themeProps('item', {density, align}); the new state test fails;Item.doc.mjstypesrefasHTMLDivElementand omitsclassNameandstyle; no browser receipt covers states, focus, hover, density, or 320px.Item.test.tsxstate case fails at base ("Expected the element to have attribute") and passes at the head.Stable visual regression:pr-a11y-evidence-a5ea981(sha256:c74b1f6fb27fd6de269bc161db47450008eae410df0bee80bebe0d8a5dce25f4), each bound to builda5ea981;data-highlighted,data-selected,data-disabledmatch every row; a selected role-less row hasaria-current="true"; disabled rows have a native disabled button,aria-disabled, half-opacity text, and no pointer events; the rest row paints--color-overlay-hoverunder the pointer and the disabled row paints nothing new;first-line; thelabelLines={2}label shows two lines of a fixture that takes three; thedir="rtl"case row is right-to-left;Stable visual regressionpassed at the exact head and the new story is outside the stable plan.Closed evidence inventory
Item,ItemProps,ItemAlign,ItemDensity, swipe typesItem/index.tsItem.doc.mjsarchitecture:public-component-apiINV1Item.tsxItem.test.tsxslot and empty-slot suitesalign(center, start, first-line)Item.tsxaligncomponent:ItemFR1–FR8densitypaddingItem.tsxdensitylabelLines,descriptionLines,layoutItem.tsxcomponent:ItemFR6onClick,href,aslink root,interactiveRef, parentroleItem.tsxItem.nestedPress.test.tsxfamily:navigation-destinations;component:ItemFR9isHighlighted,isSelected,isDisabledpaint and ARIAItem.tsxitemtarget,density,align, statesItem.tsxarchitecture:component-theming-surfaceINV6focusOutline.stylex.tsvia Itemstates-neutral-tab-*interactionOverlay.stylex.tsvia Itemstates-neutral-hover-rest-light,states-neutral-hover-disabled-lightcomponent:ItemFR9ItemSwipeLayer.tsx,useSwipeAction.tsswipeActions,swipeBehaviorspec:AST-057ref,className,style,xstyle, DOM propsItem.tsxItem.tsxcontact-list-narrow-neutral-lightFR10 eligibility report
{ "schema": "astryx.audit-eligibility/v1", "component": "Item", "package": "core", "mode": "night-watch", "rubricVersion": "1.16.6", "repository": { "base": "f384e62f5c4606e053e1aa562fdb0779c566750c", "head": "a5ea981c642b5588b363fe98d4e06cff849d4e60" }, "contract": {"id": "component:Item", "authority": "current", "changed": false}, "inventory": {"closed": true, "rows": 13, "open": []}, "unresolved": { "objective": [], "manual": [ "which slots a disabled row dims", "hover and press paint on selected and highlighted rows", "forced-colors selection paint (no current authority)", "record follow-up: name the reflected states in component:Item" ], "ownedElsewhere": [ "swipe settle curve (spec:AST-057 FR7 gap; open draft 8344)", "row clicks from portals and role-based controls (open PR 9393)" ] }, "remediations": [ {"id": "T6/INV6", "kind": "bug-fix", "evidence": "state test red at base, green at head"}, {"id": "V3", "kind": "objective-test", "evidence": "truncation test kills four mutants"}, {"id": "V15", "kind": "browser-evidence", "evidence": "ItemAudit receipts"}, {"id": "R11", "kind": "browser-evidence", "evidence": "320px ContactList receipt"}, {"id": "X5", "kind": "doc-drift", "evidence": "ref type"}, {"id": "X5b", "kind": "doc-drift", "evidence": "className and style entries"}, {"id": "X18", "kind": "doc-drift", "evidence": "xstyle description"} ], "approvals": {"specOwner": "success (no record change)"}, "checks": "all green at a5ea981 (CI run 42043189540 attempt 2, pr-a11y, pr-rtl and Stable visual regression included)", "eligible": false, "reasons": ["spec:AST-029 is phase accepted; FR11 activation has not shipped", "the pull request changes the theme target surface"] }