radix-ui / primitives

Radix Primitives is an open-source UI component library for building high-quality, accessible design systems and web apps. Maintained by @workos.
https://radix-ui.com/primitives
MIT License
15.62k stars 800 forks source link

[Tooltip] Ability to follow cursor position #1178

Closed jjenzz closed 2 years ago

jjenzz commented 2 years ago

I'm not entirely sure if tooltip would be the correct a11y pattern for this but we can investigate that if team thinks this is worth supporting.

Discussed in https://github.com/radix-ui/primitives/discussions/1090

Originally posted by **Rednegniw** January 16, 2022 Hi, first, amazing library! So thank you very much for developing it. Just had an idea - it would be cool if there was a component such as a tooltip that would follow the mouse/cursor position while hovering over an element. It might interesting, for example, when you want to tell the user why they can't click on a disabled element and so on. Something like this - https://codepen.io/paulvddool/pen/mROEGa (not mine, found randomly on google)
benoitgrelard commented 2 years ago

We probably won't do this anytime soon, so closing for now.

jjenzz commented 2 years ago

why are feature requests being closed? i don't understand the harm in them remaining otherwise wouldn't it just deter people from providing valuable suggestions?

benoitgrelard commented 2 years ago

Thanks for raising this @jjenzz.

We looked into it a bit further and it looks like it isn't something we would consider for Radix given that it would go against an accessibility criterion which are actively working towards: #620.

So rather than "not doing this anytime soon", we can clarify to say this isn't something we would consider as it breaks accessibility.

jjenzz commented 2 years ago

that makes sense in terms of tooltip, i wonder if this could be a different component though? like the multiplayer mode cursors seen here https://www.framer.com/

benoitgrelard commented 2 years ago

Given that criteria, I don't think this is possible as an accessible component, given that it shows on hover, that criteria would then be impossible to fulfill.

jjenzz commented 2 years ago

The a11y in my mind might be to aria-hidden it, similar to how HoverCard is for sighted users only. I just think it would be nice to explore the a11y of these types of cursors as it is a common pattern these days. Not a priority ofc, but a nice idea.

benoitgrelard commented 2 years ago

Is it really a common pattern? I don't think I have ever seen this in the wild.

jjenzz commented 2 years ago

i've seen it quite a bit recently. vercel did it on their conference marketing website, figma do it for multiplayer, looks like framer do too. liveblocks provide apis for live cursor support too.

benoitgrelard commented 2 years ago

Right, I guess that's a completely different pattern, more like these "live cursor" things rather than a tooltip, so not really linked to a trigger area either. It's not even really something that follows your own cursor really, it's more that you have the representation of a fake cursor with a bubble attached to it.

I'm not sure this fits well within Radix personally, but if you think there's some value Radix could provide there, feel free to submit a new primitive request.

jjenzz commented 2 years ago

yes that's what i meant by "multiplayer cursors" and is the reason why i said in the original ticket description that i am not convinced tooltip is the right pattern for this 🙂

happy to rename this ticket if it's clearer. i think it is worth exploring for the same reasons we provide a HoverCard but i have no idea how radix would do it 😅

i raised the ticket to explore someone else's request in discussions is all. a component that follows cursor could be used for "multiplayer cursors" or additional context that isn't important for SRs.

benoitgrelard commented 2 years ago

Personally I feel like this is VERY niche when compared to a pattern like HoverCard, and so probably better handled by more dedicated solutions like LiveBlocks (who incidentally also use Radix 😀).

jjenzz commented 2 years ago

I don't think liveblocks provide the components, just the websockets stuff. but yeah, it's not as common as HoverCard for sure. So is radix stance to close any requests that might be becoming popular but not currently common enough?

I agree it might not be possible at all with the radix uncontrolled compound component pattern, but seemed worth exploring someday to see (there is ContextMenu that is tied to cursor position after all). Happy to close if you don't think Radix would ever consider it though.

benoitgrelard commented 2 years ago

So is radix stance to close any requests that might be becoming popular but not currently common enough?

No, not at all! The original request was for this feature to be added to Tooltip which isn't valid because of accessibility reasons.

But like I said here 👇, this is something we can add as a new primitive request although it would be good if we can formulate a bit better what the component actually is.

I'm not sure this fits well within Radix personally, but if you think there's some value Radix could provide there, feel free to submit a new primitive request.

jjenzz commented 2 years ago

The original request was for this feature to be added to Tooltip which isn't valid because of accessibility reasons.

When I raised the ticket with "I'm not entirely sure if tooltip would be the correct a11y pattern for this" I meant that I liked the idea but perhaps tooltip isn't the right component for this. I'll rename the ticket to make this all clearer and leave it to the team to formulate the spec.

benoitgrelard commented 2 years ago

If we're going to add a new primitive request for this, I'd rather a different ticket I think as it keeps things clearer and separated. Given the original discussion was clearly about adding this to Tooltip.

jjenzz commented 2 years ago

Yeah sure, if that helps avoid confusion i can do that.