feat(slash): refactor DefaultSlashMenu with Floating UI and createPortal#126
Merged
feat(slash): refactor DefaultSlashMenu with Floating UI and createPortal#126
Conversation
…createPortal - Replace antd Dropdown with @floating-ui/react useFloating hook for auto-flip positioning - Portal to #lobe-ui-theme-app to escape stacking context issues - Add placement prop to force top/bottom direction, skipping auto-flip - Add getPopupContainer prop for custom scroll container support - Fix antd Menu CSS issues (text truncation, active state highlight) - Expose slashPlacement and getPopupContainer through Editor component
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
|
👍 @Innei |
commit: |
…dropdown style - Pass getRect function through position for live cursor tracking - Use ref-based virtual reference so getBoundingClientRect returns fresh coords - Replace whileElementsMounted with manual scroll listener (capture phase) - Align popup/item styles with @lobehub/ui Menu sharedStyle - Override antd Menu defaults for padding, color, background, item width
- Force position recalculation via rAF after reference is set - Close menu on plugin unmount to prevent orphaned portal - Skip rendering when no visible items (only dividers or empty)
Member
|
❤️ Great PR @Innei ❤️ |
Member
|
🎉 This PR is included in version 4.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Summary
DefaultSlashMenuto use@floating-ui/reactuseFloatinghook withflip()/shift()/offset()middleware, replacing manual positioning for auto-flip support#lobe-ui-theme-appviacreatePortalto escape stacking context (z-index) limitationsplacementprop (top/bottom) to force menu direction, skipping auto-flip detectiongetPopupContainerprop for custom scroll container portal target and scroll event listeningMenuCSS issues: text truncation inant-menu-title-content-with-extra, missingant-menu-item-activebackgroundslashPlacementandgetPopupContainerthrough top-levelEditorcomponent propsTest plan
slashPlacement="bottom"forces downward displaygetPopupContainerscroll event triggers position update