Repository navigation
Track D9Menu's position only while it is open - #24
Merged
Merged
Conversation
The floating wrapper is now rendered only while the menu is open, so floating-ui's autoUpdate no longer keeps scroll/resize listeners, a ResizeObserver and an IntersectionObserver for every closed menu. MenuItems is static so its content stays during the leave transition, and useFloating positions with left/top so the slide-in transform on the wrapper isn't overridden. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PhilReinking
commented
Oct 11, 2026
PhilReinking
left a comment
Contributor
Author
There was a problem hiding this comment.
OK at b86f03a, CI green.
Checked beyond the PR text, in headless Chromium and WebKit: closed menus create no observers or listeners, the open position matches main in all four stories, and the menu neither flashes on open nor jumps while it fades out. Switching menus, an outside click and rapid toggling all end at zero. aria-controls exists only while open. The spec fails on main and when the v-if is removed.
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.
D9Menu now renders its floating wrapper only while the menu is open. Closed menus no longer keep floating-ui's scroll and resize listeners, a ResizeObserver and an IntersectionObserver alive. Input's editor sidebar has one menu per block, so this grows with the form.
Fixes BITS-208
MenuItemsisstatic, so the items stay visible while the wrapper plays its leave transition.useFloatingpositions with left/top (transform: false), so the wrapper's slide-in translate isn't overridden.Tested: check, build and tests pass; the new Menu spec fails on main. Headless Brave on Storybook: all five Menu stories, plus 20 menus in a scrolled box.
Not tested: Input with this build, and Chrome, Safari or Firefox by hand.
Before and after, 20 closed menus in a scrolled box (Storybook)
usePortal.Counted by wrapping ResizeObserver, IntersectionObserver and add/removeEventListener before page load, counting only calls that come from floating-ui.
🤖 Generated with Claude Code