Skip to content

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
@cirdes cirdes merged commit 81eedb3 into ruby-ui:main Jun 26, 2025
2 checks passed
@stephannv
Copy link
Contributor

Thanks! @lsouoliveira. Great job.

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.

3 participants