fix(select): use host element as portal anchor for positioning#3860
fix(select): use host element as portal anchor for positioning#3860adrianschmidt-bot wants to merge 1 commit intoLundalogik:mainfrom
Conversation
📝 WalkthroughWalkthroughAdds an optional Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Pass the limel-notched-outline element as the anchor prop to the portal. This ensures Popper.js positions the dropdown relative to the actual trigger area, rather than the portal element which stretches to fill the parent due to its CSS (position: absolute; top: 0; bottom: 0). When a select is in a flex row with a taller sibling element, the select stretches to match the height, and the portal element stretches along with it. Previously, Popper used the portal's bounding rect for positioning, which was offset by the stretched parent. Now, the dropdown is positioned relative to the notched outline (the visual trigger area), ensuring it appears directly below the trigger regardless of parent height. This issue was introduced when the select template was refactored to use limel-notched-outline (commit 84cce3e), which changed the structure from a single wrapper div to an array of siblings. fix: Lundalogik#3858
75289f2 to
a916d66
Compare
|
Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-3860/ |
Summary
Pass the
limel-selecthost element as theanchorprop to the portal, ensuring Popper.js positions the dropdown relative to the select element itself rather than the portal element.Problem
When a
limel-selectis placed in a flex row with a taller sibling element:limel-portalelement inside the select's shadow DOM is positioned after other contentSolution
By passing the host element (
limel-select) as theanchorprop to the portal, Popper.js now positions the dropdown relative to the select element's top edge (where the trigger button is), regardless of how much the select element has stretched due to flex layout.Regression
Changes
anchorprop toSelectTemplatePropsinterfaceanchorprop tolimel-portalinMenuDropdowncomponentthis.hostas anchor inSelect.render()Fixes #3858
Summary by CodeRabbit