An open source design system that's fully customizable and agent ready
TypeScript
fix(DropdownMenu): the step-aside rule names the surface host, not a universal selector (#8411)
Cindy Zhangf85473ed5c1a
diff --git a/.changeset/dropdownmenu-submenu-host-selector.md b/.changeset/dropdownmenu-submenu-host-selector.mdnew file mode 100644index 0000000000..3e5aff59b3--- /dev/null+++ b/.changeset/dropdownmenu-submenu-host-selector.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[chore] Internal: DropdownMenu's rule that steps the root menu aside while a sub-menu's drilled-in view shows names its surface host by an internal marker instead of a universal selector. No visible or behavior change.++@cixzhangdiff --git a/packages/core/src/DropdownMenu/DropdownMenu.tsx b/packages/core/src/DropdownMenu/DropdownMenu.tsxindex 875bf11824..9127f0dfc2 100644--- a/packages/core/src/DropdownMenu/DropdownMenu.tsx+++ b/packages/core/src/DropdownMenu/DropdownMenu.tsx@@ -116,12 +116,13 @@ const MENU_MAX_BLOCK_SIZE_FALLBACK = `min(${MENU_BLOCK_CAP}, ${layerViewportInseconst MENU_TRIGGER_OPEN_BACKGROUND = `linear-gradient(${colorVars['--color-overlay-pressed']}, ${colorVars['--color-overlay-pressed']})`;// A sub-menu's drilled-in view with a header or footer renders in the surface-// host that follows the menu, as the frame marked-// `data-astryx-submenu-regions="view"` (hidden while a deeper view shows).-// While one shows, the menu and its header and footer step aside. The rule-// reads that from the DOM, so no state mirrors which view shows.+// host that follows the menu (marked `data-astryx-submenu-host`), as the frame+// marked `data-astryx-submenu-regions="view"` (hidden while a deeper view+// shows). While one shows, the menu and its header and footer step aside. The+// rule reads that from the DOM, so no state mirrors which view shows; it names+// the host by its marker rather than a universal selector.const STEPS_ASIDE_FOR_VIEW =- ':has(~ * > [data-astryx-submenu-regions="view"]:not([hidden]))';+ ':has(~ [data-astryx-submenu-host] > [data-astryx-submenu-regions="view"]:not([hidden]))';const styles = stylex.create({triggerOpen: {@@ -1533,7 +1534,11 @@ function DropdownMenuPopover({// menu too; while such a sub-menu's drilled-in view shows there, the menu and// the regions step aside (STEPS_ASIDE_FOR_VIEW).const surfaceHostElement = (- <div ref={attachSurfaceHost} {...stylex.props(styles.surfaceHost)} />+ <div+ ref={attachSurfaceHost}+ data-astryx-submenu-host=""+ {...stylex.props(styles.surfaceHost)}+ />);const renderWithRegions = (menu: ReactNode): ReactNode =>hasRegions ? (