Skip to content
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

Expose cross axis shifting in Popover #2842

Open
mazei513 opened this issue Apr 16, 2024 · 0 comments · May be fixed by #2928
Open

Expose cross axis shifting in Popover #2842

mazei513 opened this issue Apr 16, 2024 · 0 comments · May be fixed by #2928

Comments

@mazei513
Copy link

Feature request

Overview

When using a Popover, there are situations where due to the placement of the anchor and a small screen size, the popover will collide with the boundary regardless of which position it chooses. In this case, the popover will overflow.

Currently, the available tools to handle this is the CSS variable --radix-popover-content-available-height and --radix-popover-content-available-width, which can be used to then set the max-height or max-width and make the Popover content scrollable. However, this is not ideal in some cases, for example, when using the Popover to make a date picker component where a scroll would make picking a date awkward.

The underlying library used in a Popover, Floating UI, has an option to allow shifting through the cross axis. This is currently set to false with no way to override it. Would it be possible to expose this through a prop, e.g. allowCrossAxisShift?

The only complication in this is the interaction between shift and flip middlewares. However, flip could be excluded from the middlewares if crossAxis is true in shift as it performs the same role.

Who does this impact? Who is this for?

It would help users of Radix Popovers by giving an additional option for how Popover are placed.

mazei513 added a commit to mazei513/primitives that referenced this issue May 31, 2024
Gives a way to control how popper placement collision is handled, either
using flip or shift middlewares from Floating UI. By default, it is set
to flip for backwards compatibility.

Fixes issue radix-ui#2842

* [Popper] Updated storybook
@mazei513 mazei513 linked a pull request May 31, 2024 that will close this issue
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 a pull request may close this issue.

1 participant