Skip to content

fix(dropdown-menu): make submenu indicator icon and divider spacing themable - #4667

Open
athz wants to merge 1 commit into
facebook:mainfrom
athz:feat/dropdown-menu-theme-fixes
Open

fix(dropdown-menu): make submenu indicator icon and divider spacing themable#4667
athz wants to merge 1 commit into
facebook:mainfrom
athz:feat/dropdown-menu-theme-fixes

Conversation

@athz

@athz athz commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What

Two follow-ups to the DropdownMenu theme-slot work (#4600) — both fix cases where a slot exists but the property a theme wants to change doesn't actually flow through it.

Submenu indicator icon — size now themable

The astryx-dropdown-menu-indicator-icon target sat on the wrapper <span>, one level above the <Icon> that owns the glyph's width/height. A theme rule on the span could restyle the wrapper but never the icon size. Moved the target onto the <Icon> element itself (Icon merges className onto the same element that carries its size class), so a theme can now restyle the chevron's size and color directly — same mechanism as selector-indicator-icon.

Menu divider spacing — vertical margin now themable

The menu divider's margin-block was a fixed token applied via a StyleX atomic class. The single-class .astryx-dropdown-menu-divider target (specificity 0,1,0) could not out-specify the global two-class .astryx-divider.horizontal rule (0,2,0) in the same layer, so a theme's margin override was always lost. Exposed the margin as --_dropdown-menu-divider-margin (default: the existing token), matching the component's existing --_dropdown-menu-radius / --_dropdown-menu-padding private-var pattern — a theme retunes the var instead of fighting specificity.

Scope

Purely a theming-reachability fix — no behavior, layout, or a11y change; the default rendering is byte-identical. Documented the new private var in the component's theming vars/derived.

Testing

  • Updated the indicator-icon slot test to assert the target lands on the chevron glyph (astryx-icon), i.e. the element that owns the size.
  • @astryxdesign/core: DropdownMenu + ContextMenu + Breadcrumbs suites pass (154 tests), plus typecheck, typecheck:docs, sync-exports --check, and lint.

…hemable

Two follow-ups to the menu theme-slot work:

- The astryx-dropdown-menu-indicator-icon target sat on the wrapper span,
  one level above the Icon that owns the glyph size — so a theme rule on
  it could not reach the size. Move the target onto the Icon element
  itself (Icon merges className onto the sized element), so a theme can
  restyle the chevron's size and color directly.

- The menu divider's vertical margin was a fixed token that the single-
  class astryx-dropdown-menu-divider target could not out-specify against
  the global two-class .astryx-divider.horizontal rule. Expose it as
  --_dropdown-menu-divider-margin (default: the token), matching the
  component's existing private-var pattern, so a theme retunes the var
  instead of fighting specificity.
@vercel

vercel Bot commented Aug 3, 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 3, 2026 3:15am

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 3, 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 3, 2026
@github-actions

github-actions Bot commented Aug 3, 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.

Modified Components

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

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.3KB

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 3, 2026
@cixzhang

cixzhang commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

I have some plans for how we do indicator icon mapping. For the other parts though:

  • position of the indicator: as a prop is something I'm considering. There are genuinely times when left vs right might be used to improve vertical alignment or consistency with form content depending on what's important in any given use case
  • divider: i think it could be okay for this to be themeable

derived: [
{property: 'borderRadius', vars: ['--_dropdown-menu-radius']},
{property: 'padding', vars: ['--_dropdown-menu-padding']},
{property: 'marginBlock', vars: ['--_dropdown-menu-divider-margin']},

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.

Hmm I think this communicates that margin block is converted to the internal bar for block margin around the divider which is kind of odd at the menu level

const endAffordance = hasSpinner ? (
<span
{...mergeProps(
themeProps('dropdown-menu-indicator-icon'),

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.

This should be kept the same

icon="chevronRight"
size="sm"
color="secondary"
{...themeProps('dropdown-menu-indicator-icon')}

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.

Hmm seems odd to theme the size here when we apply size consistently. Have an example for how you're adjusting it?

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) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants