Skip to content

fix(core): ensure pressed overlays override hover - #5516

Merged
cixzhang merged 6 commits into
meta:mainfrom
jiunshinn:fix/5451-pressed-overlay-specificity
Aug 27, 2026
Merged

cixzhang merged 6 commits into
meta:mainfrom
jiunshinn:fix/5451-pressed-overlay-specificity

Conversation

@jiunshinn

Copy link
Copy Markdown
Contributor

Summary

  • centralize paired hover and pressed overlays in one internal StyleX utility and migrate every existing direct consumer, including Button, AvatarGroupOverflow, Calendar, navigation, selector, item, and stepper surfaces
  • repeat :active inside the (hover: hover) branch so it ties the guarded hover selector on generated specificity and wins by StyleX pseudo-state order
  • retain a bare enabled :active branch for touch input, where (hover: hover) does not match
  • add generated-CSS assertions, a Chromium cascade guard, and a core patch changeset

Root cause and event semantics

During a pointer press Chromium matches both :hover and :active. StyleX puts the media-nested hover rule in a higher priority bucket, which compiled to a selector with more repeated classes than the bare active rule. The cascade therefore kept painting the hover token throughout the press.

The shared utility now emits hover and active inside the same hover-capable media branch. Both generated selectors have specificity (3,4,0), and the active rule is emitted later. A separate enabled active selector remains outside the media query for coarse/touch input. The enabled guard stays outermost, so disabled and aria-disabled surfaces do not acquire either overlay.

Verification

  • pnpm exec vitest run scripts/build-css.test.mjs — 8 passed
  • focused core suites across Button, AvatarGroup, Calendar, command palette, selectors, Item, NumberInput, Token, DateInput touch, Outline, SideNav, Stepper, TopNav, and TreeList — 18 files / 1,238 tests passed
  • pnpm guard:pressed-overlay — Chromium verified hover, simultaneous hover+active, neutral base composition, disabled hover, and touch active fallback
  • rendered Storybook Button in Chromium — simultaneous hover+active computed the pressed rgba(0, 0, 0, 0.1) overlay instead of hover rgba(0, 0, 0, 0.05)
  • pnpm -F @astryxdesign/core typecheck
  • pnpm -F @astryxdesign/core lint — 0 errors; 49 pre-existing warnings
  • pnpm -F @astryxdesign/core build
  • commit hooks: sync, package boundaries, changesets, demo media, executable bits, CLI structure, use-client, portable scripts, i18n catalog, and CLDR weekdays

Fixes #5451

@vercel

vercel Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Error Error Aug 27, 2026 9:19am

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 25, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review labels Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

New Components

NavItem (@astryxdesign/core)
Metric Value
Bundle Size (ESM) N/A
Bundle Size (CJS) N/A
Lines of Code 79
Source Files 1
Complexity Low (1)
Exports N/A
Props Count N/A
Has Tests No
Has Stories No

Modified Components

AvatarGroup (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 269 -
Complexity N/A High (19) -
Button (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 513 -
Complexity N/A Very High (64) -
Calendar (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1477 -
Complexity N/A Very High (138) -
CommandPalette (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1010 -
Complexity N/A Very High (114) -
ComplexSelector (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 459 -
Complexity N/A Very High (44) -
DateInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 3288 -
Complexity N/A Very High (356) -
Item (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 408 -
Complexity N/A Very High (59) -
MultiSelector (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1560 -
Complexity N/A Very High (203) -
NumberInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1069 -
Complexity N/A Very High (151) -
Outline (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 673 -
Complexity N/A High (28) -
Selector (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1670 -
Complexity N/A Very High (183) -
SideNav (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 2012 -
Complexity N/A Very High (203) -
Stepper (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1261 -
Complexity N/A Very High (132) -
Token (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 454 -
Complexity N/A High (22) -
TopNav (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 2165 -
Complexity N/A Very High (150) -
TreeList (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 788 -
Complexity N/A Very High (81) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.8KB 1.2KB

Accessibility Audit

Status: 2 accessibility violation(s) found — 2 serious.

Stepper - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/28 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Token - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/10 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Visual Regression

Status: Skipped — Broad stable scope is deferred to the daily release gate. It covers 686 trusted baseline shots instead of recapturing them for this PR. View the report


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@rubyycheung rubyycheung 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.

Looks good from design. The interaction now communicates a clear rest → hover → pressed progression, with the pressed state visibly overriding hover as expected. Applying the same treatment across core interactive surfaces improves consistency while preserving touch and disabled behavior.

@cixzhang cixzhang 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.

Thanks for fixing this in the shared layer. Chromium confirms pressed now wins while disabled, touch, and pseudo-element states stay intact; source/tests cover selected and focus.

[Reviewed by Robohands]

@github-actions github-actions Bot removed needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review labels Aug 27, 2026

@cixzhang cixzhang 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.

Re-approving after the mechanical main refresh; the reviewed change is unchanged.\n\n[Reviewed by Robohands]

github-actions Bot added a commit that referenced this pull request Aug 27, 2026
github-actions Bot added a commit that referenced this pull request Aug 27, 2026

@cixzhang cixzhang 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.

Re-approving after the mechanical main refresh; the reviewed change is unchanged.

[Reviewed by Robohands]

github-actions Bot added a commit that referenced this pull request Aug 27, 2026

@cixzhang cixzhang 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.

Re-approving after the mechanical main refresh; the reviewed change is unchanged.

[Reviewed by Robohands]

github-actions Bot added a commit that referenced this pull request Aug 27, 2026
github-actions Bot added a commit that referenced this pull request Aug 27, 2026

@cixzhang cixzhang 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.

Re-approving after the mechanical main refresh; the reviewed change is unchanged.

[Reviewed by Robohands]

github-actions Bot added a commit that referenced this pull request Aug 27, 2026

@cixzhang cixzhang 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.

Re-approving after the CI-only retrigger commit; the reviewed change is unchanged.

[Reviewed by Robohands]

github-actions Bot added a commit that referenced this pull request Aug 27, 2026
github-actions Bot added a commit that referenced this pull request Aug 27, 2026
@cixzhang
cixzhang merged commit 8bb01b1 into meta:main Aug 27, 2026
57 of 60 checks passed
@github-actions
github-actions Bot deleted the fix/5451-pressed-overlay-specificity branch August 27, 2026 17:24

This branch had an error being deployed

1 failed deployment
Preview — 94f34d97 Deployed Aug 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] The pressed overlay never paints: a media-nested :hover out-specifies :active library-wide

3 participants