-
Notifications
You must be signed in to change notification settings - Fork 377
feat(Tooltip): Add optional delay prop to Tooltip #1205
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
Conversation
Pull Request Test Coverage Report for Build 4289
💛 - Coveralls |
|
Nielson Norman has published some pretty interesting guidelines on timing of exposing hidden content like tooltips. This research was one of the reasons this discussion originally popped up in our team. They suggest both entry and exit delays in the 300 to 500 ms range:
Their main argument is detecting intent: Tooltips should not show up if the user just happens to move the cursor over the tigger element, but only if the user actually intends to activate it -- otherwise, the tooltips will flicker into view for a sub-second, which may be distracting to the user. This example shows pretty well what I mean and what we're trying to avoid in our app if you move the mouse over the list fairly quickly. On the other hand, tooltips should not disappear instantly instantly when the user moves the cursor off the trigger element, to make the tooltip more resilient against brief exits and re-enters of the cursor, and to make the UX less 'hectic' -- arguably, the exit delay is more relevant e.g. for hover menus, but it seems still valid to me. What I'm taking from this discussion are two points:
I'm curious to hear what your thoughts are on this topic? |
|
I think it will be great to have entryDelay and exitDelay! |
dlabaj
left a comment
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.
Think 500 ms is a good delay for default.
|
I added entryDelay and exitDelay props that default to 500 ms. |
|
PatternFly-React preview: https://1205-pr-patternfly-react-patternfly.surge.sh |
tlabaj
left a comment
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.
LGTM
jschuler
left a comment
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.
Can we wait on #1244 first to be resolved then we can check this again? Because otherwise it doesn't look quite right
|
I rebased. It looks like #1244 has been merged. Can you please review? |
I added an optional delay prop to the Tooltip component to specify the entrance delay. The external tooltip library defaults to an entrance delay of 0 ms.
The null in {[delay, null]} gets the external tooltip library to use its default exit delay (20 ms). Controlling the exit delay wasn't mentioned in the issue, so I didn't add a prop for it. Let me know if you want an extra prop for that.
I didn't make any changes to the overrides; my IDE removed the spaces at the ends of the lines. I can set it back the way it was if you want. Let me know.
Fixes #1161.