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
Shift middleware with a boundary doesn't respect bondary bottom edge #2784
Comments
The key issue is the clipping algorithm has a bias toward top/left over bottom/right when both sides are clipped (in this case, the root boundary/viewport and element boundary).
So in this case, you want the bias not to be toward a side but rather the element boundary, right? |
I think you got it right. I would expect that |
Do you think this behavior can be achieved with current version of Floating UI? |
Not straightforwardly, it would require custom middleware instead of |
It would be great to have this feature, however it's not super ciritcal for me. So feel free to close this issue 🙂 Thanks for the clarification 🙂 |
Try to use web-ui-pack/popup instead 🙂 |
@Yegorich555 it doesn't seem like that handles the "root" viewport in the first place. It overflows the viewport if the bottom of the viewport is above the boundary bottom. You can already achieve that behavior in Floating UI with shift({ boundary: container, rootBoundary: 'document' }) This issue describes a more complicated scenario with multiple boundaries. |
@atomiks it does whatever you want, In example 3 it fits the specific container to demonstrate position-behavior |
I'm talking specifically about multiple boundaries, or in that API, multiple elements for |
@atomiks the suggested solution defines multiple boundaries automatically based on overflow content scenario. So you need to point the single root boundary. Other possible cases automatically resolves so you don't need to think about extra-scenarios and extra boundaries at all. And thanks for explanation: I've found the similar issue in the example 3 (here popup checks only visible area of target but not itself) But I don't unsertand, why need to try place popup inside 1st small scrollable area when popup actually should be placed over it to allow the user to use as much viewport as possible - like it works with Chrome popups by default. In you example it's really bad UX and I think floating-ui is correct here. |
Describe the bug
Shift middleware with a
boundary
androotBoundary: "viewport"
doesn't respect bottom edge of boundary when scrolling down. I've read through the shift middleware docs couple of times and haven't found a way to solve this issue.To Reproduce
https://codesandbox.io/p/sandbox/tender-fermat-ygc24n
Steps to reproduce the behavior:
Expected behavior
The tooltip always stays inside of the boundary. This works correctly when scrolling up/resizing the window height until the tooltip is shifted due to the bottom viewport edge but then top of the tooltip stops on the top edge of the boundary.
Screenshots
Correct behavior when scrolling up/resizing the window height.
Incrorrect behavior when scrolling down.
Context:
Additional context
I tried this and it works correctly for all sides except bottom (scrolling down). It can kindof be fixed by limiter but not quite, because the tooltip still escapes the boundary, but then stops when it meets the opposite edge of the reference element.
The text was updated successfully, but these errors were encountered: