-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Tooltip] Use hysteresis with the enterDelay #18458
[Tooltip] Use hysteresis with the enterDelay #18458
Conversation
abbad80
to
5fd5c5a
Compare
Details of bundle changes.Comparing: 508f9a3...4b8dd46
|
5fd5c5a
to
4b8dd46
Compare
assert.strictEqual(wrapper.find('[role="tooltip"]').exists(), false); | ||
clock.tick(111); | ||
wrapper.update(); | ||
assert.strictEqual(wrapper.find('[role="tooltip"]').exists(), true); | ||
}); | ||
|
||
it('should use hysteresis with the enterDelay', () => { |
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.
@eps1lon Oh boy, it's in the contrast of this file that I truly realize how tests that are written with @test-library/react are much better than the ones we have with enzyme 👏. Being able to trigger real events makes all the difference.
This PR is a nice improvement. I want to add some comments about how I see tooltips (mainly to gather my thoughts). I'm not a fan of a fixed enter delay for "hover labels" to begin with. They contribute to poor discoverability (hover labels on unlabeled buttons are more convention than intuition (anecdotal from helping family members with computer stuff)). Compare it to the practice of using a different cursor for links. This is also a mechanism to signify an affordance ("clicking this area navigates") but has no delay at all. For buttons close to each other measuring acceleration might work just as well and would avoid making it seem like two buttons accross the screen are related by immediately showing the tooltip when e.g. moving from top left to bottom right. But this would obviously require extensive UX testing. I'll add reminder to experiment with a singleton tooltip that transitions (translate) between buttons instead of re-appearing between them. Especially toolbars can benefit quite a bit from this. |
Based on https://twitter.com/ryanflorence/status/1196859248027635713, thanks @ryanflorence for sharing! The Material Design spec encourages a default value of
enterDelay
of 0ms. However, people are very likely to customize this value. The support should be as good a the native tooltips.Before
After