react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

Tooltip: OverlayArrow placed too far on the edges

Open thorbde opened this issue 1 year ago โ€ข 1 comments

Provide a general summary of the issue here

Screenshot 2024-02-21 at 14 21 17

๐Ÿค” Expected Behavior?

The OverlayArrow shouldn't go too far to the edges of the tooltip.

๐Ÿ˜ฏ Current Behavior

The OverlayArrow goes all the way to the edge when the trigger is wider than double the width of the tooltip. This is an issue when there's border radius applied to the tooltip. The positioning is set internally, not sure if it's from the TooltipTrigger or the Tooltip.

๐Ÿ’ Possible Solution

Could you provide a prop to clamp the positioning of the OverlayArrow, so that it does not go further to the edge than allowed?

๐Ÿ”ฆ Context

No response

๐Ÿ–ฅ๏ธ Steps to Reproduce

  1. Go to your storybook example, with placement: top right
  2. Set the width of the trigger/button to a width wider than double the width of the tooltip (100px for example).

Version

1.1.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

Macos Sonoma

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

thorbde avatar Feb 21 '24 13:02 thorbde

I think we'll need to expose the OverlayArrowContext. Trying to set the style prop directly on OverlayArrow doesn't allow you to make a calculation based on the value we provide, and we can't prevent the arrow from doing what it's doing because the tip can be an arbitrary size that only you know as well as the border radius.

It's either that, or we'd need to add a prop to OverlayArrow which would allow you to specify the buffer zone width.

snowystinger avatar Feb 21 '24 21:02 snowystinger

@snowystinger Is there anything I can do to help here? There's an open PR that seems to address the issue

thorbde avatar Mar 04 '24 08:03 thorbde

We will be giving that PR an API review soon, we just haven't had time yet. We'll update on there when we do. Thanks for the offer.

snowystinger avatar Mar 04 '24 21:03 snowystinger