base-ui icon indicating copy to clipboard operation
base-ui copied to clipboard

Improve/remove `delayType`

Open vladmoroz opened this issue 1 year ago • 5 comments

Instead of delayType prop, implement a heuristic to discount insignificant movement during the delay phase.

It should be easy to open hover popovers when using a Wacom tablet (hard to hold the pen perfectly steady), or if you have a slight hand tremor.

vladmoroz avatar Sep 27 '24 09:09 vladmoroz

I don't believe the Wacom issue is a problem since hoverable popovers open on click as well, which the pen input should trigger

atomiks avatar Sep 29 '24 21:09 atomiks

It is an issue though with tooltips and preview cards; also when you frequently use mouse and are used to expect a hover interaction on certain popovers and menus. This is from my own first-hand experience.

vladmoroz avatar Sep 30 '24 06:09 vladmoroz

It is an issue though with tooltips and preview cards

These only support mouse pointer types though, pen/touch don't open it at all.

also when you frequently use mouse and are used to expect a hover interaction on certain popovers and menus.

Can you clarify this? Why would you expect hover to work when not using a hover capable input?


Maybe a better solution to handle hover tremors is to use a fallback delay that's ~2-3x as long as the rest delay, ensuring it always opens eventually even if the pointer is constantly moving to some degree? Mainly because it's hard to determine a heuristic that will handle all cases well, while a fallback delay is guaranteed to work.

For instance, this seems to work okay from my rough testing, but it's likely not going to cover all possible tremors; a fallback delay does however.

event.movementX ** 2 + event.movementY ** 2 < 2

atomiks avatar Oct 08 '24 07:10 atomiks

@atomiks Wacom tablets work more like a mouse than anything else, with the pointer moving as you hover with the pen over the tablet. They do report pen pointer type, though, same as iPad stylus which doesn't do hovers in comparison.

Maybe a better solution to handle hover tremors is to use a fallback delay that's ~2-3x as long as the rest delay, ensuring it always opens eventually even if the pointer is constantly moving to some degree? Mainly because it's hard to determine a heuristic that will handle all cases well, while a fallback delay is guaranteed to work.

It might be too implicit/arbitrary? Like at 2-3x rest delay you are probably better off clicking anyway?

vladmoroz avatar Oct 08 '24 07:10 vladmoroz

@vladmoroz yeah my confusion was thinking Wacom tablets worked like iPad stylus where you press the screen. I remember using one in 2014 but completely forgot about it. PR: https://github.com/floating-ui/floating-ui/pull/3073

atomiks avatar Oct 10 '24 00:10 atomiks

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

github-actions[bot] avatar Oct 15 '24 11:10 github-actions[bot]