Skip to content
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

Improve/remove delayType #654

Closed
vladmoroz opened this issue Sep 27, 2024 · 6 comments · Fixed by #730
Closed

Improve/remove delayType #654

vladmoroz opened this issue Sep 27, 2024 · 6 comments · Fixed by #730
Assignees
Labels
component: menu This is the name of the generic UI component, not the React module! component: popover The React component. component: tooltip This is the name of the generic UI component, not the React module!

Comments

@vladmoroz
Copy link
Contributor

vladmoroz commented Sep 27, 2024

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 vladmoroz added component: menu This is the name of the generic UI component, not the React module! component: tooltip This is the name of the generic UI component, not the React module! component: popover The React component. labels Sep 27, 2024
@atomiks atomiks self-assigned this Sep 29, 2024
@atomiks
Copy link
Contributor

atomiks commented Sep 29, 2024

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

@vladmoroz
Copy link
Contributor Author

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.

@github-project-automation github-project-automation bot moved this to Backlog in Base UI Alpha Oct 7, 2024
@colmtuite colmtuite moved this from Backlog to Selected in Base UI Alpha Oct 7, 2024
@atomiks
Copy link
Contributor

atomiks commented Oct 8, 2024

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

@vladmoroz
Copy link
Contributor Author

vladmoroz commented Oct 8, 2024

@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?

@atomiks
Copy link
Contributor

atomiks commented Oct 10, 2024

@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: floating-ui/floating-ui#3073

Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: menu This is the name of the generic UI component, not the React module! component: popover The React component. component: tooltip This is the name of the generic UI component, not the React module!
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants