Skip to content

Allow to pass the strategy option to dropdown menu #243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

lsouoliveira
Copy link
Contributor

@lsouoliveira lsouoliveira commented Mar 26, 2025

When the dropdown menu is inside a container with position: relative and overflow: hidden, it remains confined within its parent element and cannot escape the clipping context. Floating UI's computePosition method allows you to pass an option called strategy, which accepts either absolute or fixed. When the strategy is set to fixed, the dropdown can break free from its parent’s clipping context. This is especially useful in a sidebar, where elements have position: relative, and you may want to display the dropdown to the right of the sidebar.

This PR also fixes a bug in the dropdown content background.

Current behaviour:
image
image

With strategy as fixed:
image
image

References

@lsouoliveira lsouoliveira force-pushed the allow-to-pass-strategy-option-to-dropdown-menu branch from 82b8850 to e6f1932 Compare March 26, 2025 11:36
@lsouoliveira lsouoliveira changed the title Allow to pass strategy option to dropdown menu Allow to pass the strategy option to dropdown menu Mar 26, 2025
@lsouoliveira lsouoliveira marked this pull request as ready for review March 26, 2025 11:49
@lsouoliveira lsouoliveira marked this pull request as draft March 26, 2025 20:57
@lsouoliveira lsouoliveira force-pushed the allow-to-pass-strategy-option-to-dropdown-menu branch from 3183b39 to 8e2f9a1 Compare March 26, 2025 21:00
@lsouoliveira lsouoliveira marked this pull request as ready for review March 26, 2025 21:08
…ub.com:lsouoliveira/ruby_ui into allow-to-pass-strategy-option-to-dropdown-menu
@lsouoliveira lsouoliveira force-pushed the allow-to-pass-strategy-option-to-dropdown-menu branch from 8e2f9a1 to 9846ec4 Compare March 26, 2025 21:16
@stephannv stephannv self-requested a review March 31, 2025 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant