Skip to content

fix(SideNav): a mouse or pen press on a button in a row's actions, or on its expand toggle, paints only that control - #14303

Merged
cixzhang merged 4 commits into
mainfrom
lane2/sidenavitem-nested-press
Dec 4, 2026
Merged

cixzhang merged 4 commits into
mainfrom
lane2/sidenavitem-nested-press

Conversation

@cixzhang

@cixzhang cixzhang commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A mouse or pen user who holds down a button, link or form control in a SideNavItem's actions (such as its More menu button), or the expand/collapse button of a collapsible item with href or onClick, sees the whole navigation row darken one press step, as if the press would open that page. Only the control is being pressed: releasing it never navigates. After this change only the pressed control darkens, on an enabled row and on a disabled row whose actions stay operable. A press on the row's own label or icon still darkens the row. A nested control the shared rule does not recognize, such as a <summary> or an element with role="menuitemcheckbox", still darkens the row, as in every other container that uses the rule; architecture:press-feedback now states that gap.

Problem and solution fit

  • Why does the row darken? A browser applies :active to every ancestor of the pressed element, and the row paints its pressed overlay at :active.
  • Why does that harm the task? The row's press says "this opens the page"; on a nested control it tells the person the wrong thing about what the release will do.
  • Why does it matter? The navigation rail is where people move between pages, so a misleading press there invites a hesitant or wrong release.

ClickableCard, SelectableCard, Item, TreeList rows and Token already stop this with the shared nested-press rule (cancelNestedPress): a press that starts on a nested control that does not run the container turns off the container's :active paint until the press ends. SideNavItem's row did not use it. The row now calls that rule from its pointer-down handler, with the primary link or button as the row's own action.

Expected behavior and authority

architecture:press-feedback INV7: "A press on a nested interactive element that does not activate the row or card paints that element only, never the row or card." The record listed SideNavItem's actions control and expand/collapse button as an INV7 gap; this pull request removes SideNavItem from that gap. component:SideNavItem already rejects "a toggle or action that activates the row", and now lists architecture:press-feedback among its architecture records.

Smallest restoration

One onPointerDown on the row wrapper that SideNavItem renders when it has an independent expand toggle or actions. It calls cancelNestedPress with the primary element as the row's own action. It runs on a disabled row too, since that row's actions stay operable (component:SideNavItem FR3) and the rule only turns the row's paint off. The row's styles already read the nested-press variable through the shared interaction overlay, and the toggle resets it on itself, so no style changes. A row without a wrapper is unchanged: its nested end content sits inside the primary link and runs it, so the row keeps its press there.

Evidence

  • Reproduction before the change: with main's SideNavItem.tsx, the new SideNavItem cases in nestedControlPress.test.tsx fail 15 of 18 (the row keeps its press paint for mouse and pen presses on the actions button and on the expand toggle, and for a finger on a coarse-pointer device).
  • Result after the change: nestedControlPress.test.tsx passes 78/78, including both SideNavItem cases and a disabled row with operable actions (which fails with main's SideNavItem).
  • Representative unchanged path: a mouse press on the row's own link keeps the row's press paint (the "keeps its press paint for a mouse press on its own surface" case, both SideNavItem variants).
  • Regression test: nestedControlPress.test.tsx (jsdom), plus a SideNavItem row in the Nested Control Press story, which NestedControlPress.a11y.chromium.spec.ts checks in real Chromium for a mouse, a pen and a finger.

Scope

Components: SideNavItem

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • vitest run packages/core/src/__tests__/nestedControlPress.test.tsx packages/core/src/SideNav: 541/541, including the disabled-row case.
  • vitest run packages/core/src/__tests__/nestedControlPress.test.tsx at 64e1cd42: 77/77. With main's SideNavItem: 15 of the 18 SideNavItem cases fail.
  • vitest run packages/core/src/SideNav: pass.
  • pnpm check:knowledge: clean.
  • Real Chromium (Linux): NestedControlPress.a11y.chromium.spec.ts with the new SideNavItem row: 25/25. With main's SideNavItem, the SideNavItem row's mouse and pen cases fail; its finger and own-surface cases pass.
  • tsc for Core and Storybook: pass. vitest run packages/core/src/SideNav packages/core/src/__tests__/nestedControlPress.test.tsx packages/core/src/hooks/useClickableContainer.test.tsx: 562/562 at 64e1cd42; 563/563 at this head, which adds the disabled-row case. ESLint --max-warnings 0 on the changed TypeScript files: clean.

@vercel

vercel Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Dec 4, 2026 11:21am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 4, 2026
@astracat-bot

astracat-bot Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Dec 4, 2026, 11:39 AM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 4cd4bd6

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
SideNavItem 88.2 kB (+332 B) · 12.6 kB CSS (0) — ✓ · ✓ · ✓
SideNav 120.5 kB (0) · 12.8 kB CSS (0) — ✓ · ✓ · ✓
SideNavCollapseButton 72.5 kB (0) · 11.4 kB CSS (0) — ✓ · ✓ · ✓

✓ passed · ✗ needs a fix · Δ changed, for review in the shots below · ↻ needs re-verify · — did not run

2 more components
Component Size LoC Visual · A11y · RTL
SideNavHeading 94.6 kB (0) · 12.8 kB CSS (0) — ✓ · ✓ · ✓
SideNavSection 7.3 kB (0) · 3.8 kB CSS (0) — ✓ · ✓ · ✓

Package size: @astryxdesign/core 8.19 MB packed (+347 B); no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@cixzhang

cixzhang commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 64e1cd4

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Dec 4, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. The fix is right for an enabled row: holding the actions button or the expand toggle now leaves the row at its hover tint instead of its pressed tint, reproduced here in Chromium against both revisions, and a press on the row's own label still paints the row. It stops short of one reachable case, and three of the pull request's texts and one record line state more than it delivers.

  • A disabled row with operable actions still darkens for a mouse or pen press — SideNavItem.tsx returns before the shared rule when the row is disabled, while the actions slot keeps its pointer events and component:SideNavItem FR3 keeps those actions operable, so holding that control still paints the row's pressed overlay at this head, exactly as on main (architecture:press-feedback INV7 and INV8, spec:AST-085 FR6); the smallest fix is to drop the isDisabled early return, since the shared rule only turns paint off, and to add a disabled case to nestedControlPress.test.tsx.
  • The claim covers every actions control, but the shared rule recognizes only the controls in its selector list — the shared rule recognizes buttons, links, form controls and the roles its selector list names, so a control in actions outside that list still darkens the row (measured here at this head with role="menuitemcheckbox", a <summary> and a contenteditable role="textbox"); the list is shared with Item, Token, TreeList and both cards, so the correction is the wording, for example naming the common case, the row's More menu button.
  • The description's comparison with the other nested-press containers' records is wrong — none of the five other nested-press containers' records lists architecture:press-feedback in its architecture list (four cite it only in prose), so the clause comparing this record's new link with theirs should go, while the link itself is worth keeping.

Next: decide whether a disabled row's press is in scope, then make the title, the changeset, the User impact paragraph and the press-feedback gap line say exactly what the code does.

Claims and files checked

Review mode: full; reason: requested

Claims

  • Title and changeset, a mouse or pen press on the row's actions control or expand toggle paints only that control: false, see the first two findings.
  • User impact, the whole row darkens one press step today: verified, measured on the base revision in Chromium here.
  • User impact, after the change only the pressed control darkens: false, the disabled row above.
  • User impact, a press on the row's label or icon still paints the row: verified, measured on this revision in Chromium here.
  • Five other containers already use the shared nested-press rule and SideNavItem did not: verified by reading both revisions.
  • The quoted press-feedback invariant and its gap entry for this component: verified against that record.
  • This component's record now links press feedback as the other containers' records do: false, the third finding.
  • Smallest restoration: one pointerdown handler on the row wrapper, nothing on a disabled row, no style change, and rows without a wrapper unchanged: verified by reading the code and by the measurements above.
  • The new cases fail 15 of 18 against the previous implementation: verified by running the head's test file on the base revision here, 15 failures.
  • The jsdom suite passes 77 of 77, the SideNav suites pass, the three paths total 562, the knowledge check is clean, lint is clean on the changed files, and Core type-checks: verified by running each here.
  • Real-Chromium accessibility spec 25 of 25, its red-first result, and the Storybook type-check: reported, not run here and not run by this revision's CI.
  • The four scope checkboxes: verified, one defect, no separable tagalong, an empty public API delta, and no internal context in the public text.

Files

  • .changeset/sidenavitem-nested-press.md: its sentence is the claim the first two findings bound.
  • apps/storybook/stories/NestedControlPress.stories.tsx: clear, the new case matches the Playwright fixture's selector and nested-control name.
  • docs/architecture/press-feedback.md: the readiness row drops this component from the gap list while the disabled case remains (first finding); the other eight rows are unchanged apart from table padding.
  • docs/specs/components/SideNav/SideNavItem.spec.md: clear, it adds the architecture link and no requirement.
  • packages/core/src/SideNav/SideNavItem.tsx: the first two findings; the rest of the handler is correct, and the row's own action is read by position where the other containers hold a reference.
  • packages/core/src/__tests__/NestedControlPress.a11y.chromium.spec.ts: clear.
  • packages/core/src/__tests__/nestedControlPress.test.tsx: clear for what it covers; no case exercises a disabled row.

Automated review (maintainer link)

Comment on lines +936 to +940
cancelNestedPress(
event,
event.currentTarget,
event.currentTarget.firstElementChild,
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two notes on this call. The rule only recognizes the elements in INTERACTIVE_SELECTORS, so a control in actions outside that list (for example role="menuitemcheckbox", a <summary>, or a contenteditable role="textbox") still darkens the row — the title and changeset read as covering those too. And the row's own action is read by position here, where Item and TreeList pass a ref; it is correct today because the primary element renders first, and it would fail silently if anything were ever rendered before it.

…ther; press feedback states the shared rule's selector gap
@cixzhang cixzhang changed the title fix(SideNav): a mouse or pen press on a row's actions control or expand toggle paints only that control fix(SideNav): a mouse or pen press on a button in a row's actions, or on its expand toggle, paints only that control Dec 4, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Dec 4, 2026
@cixzhang

cixzhang commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec a0760a6

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Dec 4, 2026

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet, because every workflow skips while the pull request is a draft, so the checks run once it is marked ready for review. Holding a row's actions button, its expand toggle, or a disabled row's operable action now leaves the row at its hover tint instead of its pressed tint, reproduced locally in Chromium against both revisions, and the new jsdom cases fail against the base and pass on this head. The corrected test tally in the description matches a local run of the same three paths (563 of 563).

Claims and files checked

Review mode: same-head; reason: none

Title read live: fix(SideNav): a mouse or pen press on a button in a row's actions, or on its expand toggle, paints only that control

Claims

  • Title and changeset, a mouse or pen press on a button, link or form control in a row's actions, or on its expand toggle, paints only that control, while a press on the row's label still paints the row: verified by the jsdom mouse and pen cases (run locally, failing against the base) and a local Chromium probe of both revisions on the More menu button, the expand toggle, native enabled and disabled buttons, and a disabled row's action.
  • User impact, today the whole row darkens one press step: verified, measured locally on the base revision.
  • User impact, releasing the nested control never navigates: verified by the component record's rule that an action never activates the row, which this change leaves alone.
  • User impact, after the change only the control darkens, on enabled rows and on disabled rows whose actions stay operable: verified by the probe and by the new disabled-row case, which fails against the base.
  • User impact, a press on the row's own label or icon still darkens the row: verified by the own-surface case for both row shapes and by pixel-identical frames of the two revisions.
  • User impact, a nested control the shared rule does not recognize still darkens the row, as in every other container that uses it, and the press-feedback record states that gap: verified by reading the shared selector list and the test function each caller passes.
  • Problem, the browser applies the active state to every ancestor and the row paints its press there: verified in the shared overlay styles.
  • Problem, the cards, Item, TreeList rows and Token already use the shared rule, and the row now calls it with the primary element as its own action: verified by listing every caller of the rule.
  • Expected behaviour, the quoted press-feedback invariant and the gap entry this change removes: verified against the record on the default branch.
  • Expected behaviour, the component record rejects a toggle or action that activates the row and now lists the press-feedback record: verified.
  • Smallest restoration, one pointer-down handler on the row wrapper that also runs on disabled rows, no style change, and rows without a wrapper unchanged: verified by reading the code.
  • Evidence, the new cases fail 15 of 18 with the default branch's component: verified, the head's test file run locally against the base fails those 15 plus the disabled-row case.
  • Evidence, 78 of 78 after the change with the row's own press kept for both shapes: verified, run locally.
  • Evidence, a story row and the real-Chromium spec cover a mouse, a pen and a finger: verified that the story case and the spec entry exist and match; the spec's own result is reported, below.
  • The four scope checkboxes: verified, one defect, no separable tagalong, no new public API, default or interaction model, and no internal context in the public text.
  • Testing, the jsdom file with the SideNav tests 541 of 541, and the SideNav tests passing: verified, run locally.
  • Testing, 77 of 77 and the red result at the previous revision, and 562 of 562 there: reported, consistent with this head's counts.
  • Testing, the knowledge check, Core and Storybook type checks, and ESLint on the changed files: verified, run locally.
  • Testing, 563 of 563 for the three paths at this head: verified, run locally.
  • Testing, the real-Chromium spec 25 of 25 and its red result: reported, not run locally or by CI at this head.

Files

  • The changeset: clear, its claim and bound match the shared rule.
  • The nested-control-press story: clear, its new row's id and button name match the Playwright entry.
  • The press-feedback record: clear, the gap list drops this component and gains the selector-list gap, both true; the other rows change only in table padding.
  • This component's record: clear, it adds the architecture link and no requirement.
  • The SideNavItem source: clear; the row's own action is still read by position, which the open thread on that call covers.
  • The real-Chromium spec: clear, its new entry matches the story.
  • The jsdom press test: clear, its new cases fail against the base and pass here.

Automated review (maintainer link)

@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Dec 4, 2026
@cixzhang
cixzhang marked this pull request as ready for review December 4, 2026 08:36
…ted-press

# Conflicts:
#	apps/storybook/stories/NestedControlPress.stories.tsx
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Dec 4, 2026
@cixzhang

cixzhang commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 4cd4bd6

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Dec 4, 2026

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI, with no blocking finding.

The new onPointerDown on the row wrapper restores the shared nested-press rule for SideNavItem: while a mouse or pen holds a control in a row's actions, or the row's expand toggle, the row stays at its hover fill, and a press on the row's own link still paints the row. Both sides were reproduced here: the new jsdom cases fail 16 of 78 against this branch's base and pass 78 of 78 on this head, and a Chromium probe of each tree measures the row at rgba(0, 0, 0, 0.1) before the change and rgba(0, 0, 0, 0.05) after, including a disabled row whose actions stay operable, with the row's own-link frames pixel-identical. The heavy CI jobs were deferred until a review passed and have now started at this head, with none failing at the last read, so the approval is pending CI and nothing else is needed here.

Claims and files checked

Review mode: incremental; reason: none

  • Title, a mouse or pen press on a button in a row's actions or on its expand toggle paints only that control: verified — jsdom mouse, pen and secondary-button cases for both SideNavItem shapes (red-first on the base, passing on the head) and the Chromium probe of both trees.
  • Changeset, a press on a button, link or form control in actions, or on the expand/collapse button, no longer darkens the row: verified — every element kind those words cover is in the shared rule's interactive selector list, read at this head.
  • Changeset, a press on the row's label still paints the row: verified — the row's own link measures rgba(0, 0, 0, 0.1) on both trees and the frames are pixel-identical.
  • User impact, the whole row darkened one press step before this change: verified on the base — hover rgba(0, 0, 0, 0.05) to rgba(0, 0, 0, 0.1) for the actions button and for the expand toggle.
  • User impact, after the change only the pressed control darkens, on an enabled row and on a disabled row whose actions stay operable: verified — probe of both trees plus the new disabled-row case, which fails on the base.
  • User impact, a nested control the shared rule does not recognize (a summary element, a menuitemcheckbox role) still darkens the row: verified — those are absent from the selector list, and the architecture record now states that gap.
  • Authority, the architecture record listed this case as an INV7 gap and the pull request removes it while adding the selector-list gap: verified against the record at the tip of the default branch.
  • Authority, the component record rejects a toggle or action that activates the row and now lists press feedback among its architecture records: verified in the record.
  • Smallest restoration, one handler on the wrapper, running on a disabled row, with no style change, and a row without a wrapper unchanged: verified by reading the component and the shared interaction-overlay styles; nothing in the spread it joins carries a pointer handler.
  • Evidence, the new SideNavItem cases fail 15 of 18 against the base: verified — 16 of 78 fail here, the 15 per-case SideNavItem tests plus the disabled-row case named in the next bullet.
  • Testing, 541 of 541, 563 of 563 at this head, the SideNav suite, check:knowledge, ESLint and tsc for Core and Storybook: verified — all re-run here with the same results; the 562 of 562 figure for the earlier revision is reported evidence about another revision.
  • Testing, the real-Chromium accessibility spec at 25 of 25 and its red-first result: reported — that job has not run at this head and nothing here reproduced it; the spec file at this head does hold exactly those 25 cases.
  • .changeset/sidenavitem-nested-press.md: clear — matches the title and the User impact section.
  • apps/storybook/stories/NestedControlPress.stories.tsx: clear — the new SideNavItem case and its merge with the default branch's delegated-row case; the case id and nested button name match the Playwright entry.
  • docs/architecture/press-feedback.md: clear — only the Compatibility/readiness row changes text; both new gap sentences match the code at this head.
  • docs/specs/components/SideNav/SideNavItem.spec.md: clear — one architecture record added, no requirement and no approval line changed.
  • packages/core/src/SideNav/SideNavItem.tsx: clear — the handler, its comment and the wrapper it sits on; the collapsed rail returns earlier and is untouched.
  • packages/core/src/__tests__/nestedControlPress.test.tsx: clear — two new cases, the disabled-row case and the other-document branch, all exercised here.
  • packages/core/src/__tests__/NestedControlPress.a11y.chromium.spec.ts: clear — one container entry whose selector and nested name match the story.

Automated review (maintainer link)

@cixzhang
cixzhang merged commit d86d409 into main Dec 4, 2026
145 of 148 checks passed
@cixzhang
cixzhang deleted the lane2/sidenavitem-nested-press branch December 4, 2026 12:34

This branch was successfully deployed

1 active deployment
Preview — 4cd4bd6c Deployed Dec 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant