-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 arrowBoundaryOffset
and internalize arrowSize
calculation on RAC <Popover />
and <Tooltip />
#5936
Conversation
Hey! We had a chance to talk about this one today. Instead of adding a prop to the OverlayArrow, we'd like to expose arrowOffsetBoundary on Popover, which already exists as a prop on usePopover
and can see the prop description here https://react-spectrum.adobe.com/react-aria/usePopover.html#usepopover This will allow the value to get into calculatePosition reducing the work a user has to do. In addition, we think that we could get a ref to the OverlayArrow through
|
This reverts commit 7f70d2d.
@snowystinger You mentioned exposing the prop in Popover, would it also be exposed in Tooltip? |
@snowystinger Thanks for the feedback! I revised the fix according to your feedback to both The usage of Let me know if I missed anything! @thorbde I added the same fix to the tooltip as well! |
hm not sure why the test |
offset
prop to <OverlayArrow />
arrowBoundaryOffset
and internalize arrowSize
on RAC <Popover />
and <Tooltip />
arrowBoundaryOffset
and internalize arrowSize
on RAC <Popover />
and <Tooltip />
arrowBoundaryOffset
and internalize arrowSize
calculation on RAC <Popover />
and <Tooltip />
Looks like it just intermittently failed, that's a new one, I'll keep an eye out for it. |
GET_BUILD |
Build successful! 🎉 |
GET_BUILD |
Build successful! 🎉 |
## API Changes
unknown top level export { type: 'any' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we need to do a little more clamping work as I can get them to separate, and it also affects the overall placement when I set the offsetboundary to something extreme. I think we can handle it in a follow up
it's probably not a common case. most of the time this number should be the border radius of the popover, in which case the most it'll ever be is 50% of the height where we don't need to worry about clamping yet.
Thanks for the stories and PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I agree with @snowystinger, we can handle potentially clamping the value in a followup if at all. I figure since the user is in control of the value that they can judge a good value to use for now (I figure it will usually be a small number just to partially offset/limit the arrow position from the edge)
Closes #5917
Hello, I thought it would be nicer, in terms of DX, to add a prop with which users can adjust their arrow position, rather than exposing
OverlayArrowContext
as suggested in #5917 (comment).The way this PR implements the feature relies on the fact that
calculatePosition
returns only one of eitherarrowOffsetLeft
orarrowOffsetTop
(not both) with a valid value. So I added a defensive test case incalculatePosition.test.ts
as well.Frankly, it's a little unintuitive which way is positive/negative when setting the
props.offset
, but I believe it's easy enough for the user to figure out the direction of the offset by changing it a few times.Or maybe there's yet a better way to do this. I'm open to any suggestion from you guys!
Thanks.
✅ Pull Request Checklist:
📝 Test Instructions:
Stories
http://localhost:9003/?path=/story/react-aria-components--tooltip-arrow-offest-example&providerSwitcher-express=false&strict=true
Docs
🧢 Your Project: