You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the feature in detail (code, mocks, or screenshots encouraged)
It would be nice to have an ability to pass a callback as values for sideOffset / alignOffset to get the side that's going to be used before determine the offsets.
Something like
typeSideOffset=number|(side: Side)=>number;
I'm using the library somewhat unconventionally by creating a custom context menu using popovers as I want a single instance of the component at all times.
I have a popover with the content dynamically anchored to the element that is right clicked. Then manually calculate the offsets using the mouse event. This works fine until the collision detection flips the side and then the offset causes the element to be very far from the target element.
First screenshot shows the typical behavior.
Second screenshot shows the distance from the mouse when collision detection flips the side.
What type of pull request would this be?
Enhancement
Provide relevant links or additional information.
Using next branch
The text was updated successfully, but these errors were encountered:
I'll need to dig further into floating UI's source code to determine how feasible this is.
My initial shot at it resulted in the floating state breaking entirely, which leads me to believe it needs to know the sideOffset/alignOffset before determining which side to move the floating content to (imagine if you had sideOffset={3000} and it wouldn't fit on the flipped side + that offset).
So it likely takes that into account when computing the side/alignment and if so, it makes this essentially impossible to execute before the flip happens and would need to be a side effect executed after the positioning likely creating a jarring UX where it quickly moves to one position and then immediately where you actually want it to go.
So, I took a look through the context menu code and realized I was kinda going down an unnecessary complex path. I imitated what you do with having a virtualEl that's just of type Measurable and have it working much better with less code. Personally, I don't need this feature anymore, though I'm not sure whether or not to close the issue in case someone actually needs it.
Describe the feature in detail (code, mocks, or screenshots encouraged)
It would be nice to have an ability to pass a callback as values for sideOffset / alignOffset to get the side that's going to be used before determine the offsets.
Something like
I'm using the library somewhat unconventionally by creating a custom context menu using popovers as I want a single instance of the component at all times.
I have a popover with the content dynamically anchored to the element that is right clicked. Then manually calculate the offsets using the mouse event. This works fine until the collision detection flips the side and then the offset causes the element to be very far from the target element.
First screenshot shows the typical behavior.
Second screenshot shows the distance from the mouse when collision detection flips the side.
What type of pull request would this be?
Enhancement
Provide relevant links or additional information.
Using next branch
The text was updated successfully, but these errors were encountered: