Repository navigation
fix(core): TopNavMegaMenu anchors to its trigger outside a <nav> (#4905) - #4916
Merged
imdreamrunner merged 4 commits intoAug 14, 2026
Merged
Conversation
…a#4905) DefaultMegaMenu set its CSS anchor via triggerButtonRef.current?.closest('nav') and skipped the triggerRef call entirely when no <nav> ancestor exists — so a standalone render (like the docsite Properties preview) left no element carrying the anchor name. The panel's position-area then computes to 'none' and the top-layer popover pins to the viewport top-left corner. Fall back to anchoring on the trigger button itself so the panel opens below its trigger wherever the component is rendered.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsTopNav (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
imdreamrunner
requested changes
Aug 12, 2026
…or logic Per review: the Properties preview should render TopNavMegaMenu in its real context. Declare playground.wrapper: TopNav in TopNavMegaMenu.doc.mjs (the preview injects the component as children, an alias for startContent) so the panel anchors to the wrapper's <nav> and opens below the bar. Revert the trigger-anchor fallback in TopNavMegaMenu.tsx and its tests; drop the changeset since the published component behavior no longer changes.
imdreamrunner
approved these changes
Aug 14, 2026
…eta#4915) The docsite generator keeps its own copy of the authoring doc types. ComponentThemingTarget.deprecatedFor and ComponentThemingDerivedVar.replaces were added upstream but never mirrored here, so componentRegistry.ts emits fields its own interfaces reject and the docsite build fails type checking.
imdreamrunner
enabled auto-merge (squash)
August 14, 2026 04:08
imdreamrunner
disabled auto-merge
August 14, 2026 04:09
6 tasks done
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4905.
Problem
Opening TopNavMegaMenu in the docsite Properties preview renders the dropdown at the viewport top-left corner, detached from its trigger.
Root cause
DefaultMegaMenusets its CSS anchor withtriggerButtonRef.current?.closest('nav')and only callspopover.triggerRef(...)when a<nav>ancestor is found. The Properties preview renders the component standalone, so no element ever carries the layer'sanchor-name. The panel still getsposition-anchor/position-areafromuseLayer, and with no matching anchorposition-areacomputes tonone— which pins the top-layer popover to the viewport corner becauseuseLayer's base styles zero the UA popover margins (the exact failure mode already documented inuseLayer.tsx'sgetPositionAreacomment).Fix
Fall back to anchoring on the trigger button itself when there is no
<nav>ancestor:Inside a TopNav nothing changes — the panel still anchors to the surrounding
<nav>and spans below the bar. Standalone, the panel now opens below its trigger and stays associated with the preview area, which is the behavior the issue expects.Tests
Added an "anchor wiring" describe block to
TopNavMegaMenu.test.tsx:<nav>: the<nav>carries the layer anchor name, the trigger does not (existing behavior preserved);<nav>ancestor: the trigger itself carries the anchor name, and the popup'sposition-anchormatches it.vitest run packages/core/src/TopNav/TopNavMegaMenu.test.tsx— 39 tests pass. All pre-commitcheck:*scripts pass; changeset included (patch,@astryxdesign/core).