Skip to content

fix(selector): clear the trigger by the standard menu gap - #5003

Merged
cixzhang merged 1 commit into
mainfrom
fix/selector-toggle-and-menu-gap
Aug 13, 2026
Merged

fix(selector): clear the trigger by the standard menu gap#5003
cixzhang merged 1 commit into
mainfrom
fix/selector-toggle-and-menu-gap

Conversation

@cixzhang

@cixzhang cixzhang commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What

Selector's menu now clears its trigger by the standard --spacing-1 gap whenever it is not overlaying it — every explicit placement (above/below/start/end) and search mode. The default selected-item overlay is untouched: it owns its block geometry through a measured negative margin and is meant to sit on the trigger.

Also adds a Placements story. placement shipped in #2770 with a single PlacementAbove story; below, start and end had no coverage at all.

Why

Selector was the only anchored menu in the system with no clearance from its anchor. Measured in Chrome 151 against local Storybook, menu edge to trigger edge:

before after
Selector placement="above" 0 px 4 px
Selector hasSearch 0 px 4 px
MultiSelector (reference) 4 px 4 px

DropdownMenu, MultiSelector, ComplexSelector, Popover, Tooltip, HoverCard, TopNavMenu, BaseTypeahead and PowerSearch all pass offset: spacingVars['--spacing-1'] already; Selector passed nothing. The clearance goes on both edges of the placement axis, so it survives a position-try-fallbacks flip (#4803).

placement="above", before and after — the menu's shadow used to bleed into the trigger's top border:

before after
before after

The new story, with start open (4 px on the inline axis — useLayer puts the offset on the placement axis, so start/end clear sideways):

placements

Risk

Visual only, 4 px, and only for menus that already opened beside the trigger rather than over it. Default Selector renders identically.

Overlap with #4976

That PR carries this same clearance as part of flipping the default placement to below. Landing it here separately leaves #4976 as purely the default-flip decision, which is the part that needs a call rather than a fix.

Test plan

  • Three tests, written red-first: the two clearance assertions fail on main and pass here; the overlay regression guard (no --x-marginBlock*, measured margin-block-start: -110px intact) passes both ways.
  • Full Selector suite green (113).
  • Measured in real Chrome for all four placements: below 4 px block, above 4 px block, start/end 4 px inline; default overlay unchanged at -37px.

Selector was the only anchored menu in the system with no clearance from
its anchor: every explicit placement, and search mode, sat flush against
the trigger while DropdownMenu, MultiSelector, ComplexSelector, Popover
and Tooltip all pass the standard --spacing-1 offset. The default
selected-item overlay keeps its measured geometry and stays flush by
design.

Adds a Placements story — below/start/end had no coverage, only above.
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Aug 13, 2026 8:52pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 13, 2026
@github-actions

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.

Modified Components

Selector (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1474 -
Complexity N/A Very High (153) -

Bundle Size Summary

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

Accessibility Audit

Status: No accessibility violations detected.


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

github-actions Bot added a commit that referenced this pull request Aug 13, 2026
@cixzhang
cixzhang merged commit 752dd23 into main Aug 13, 2026
18 checks passed
@github-actions
github-actions Bot deleted the fix/selector-toggle-and-menu-gap branch August 14, 2026 06:33
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant