-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
rustdoc: use browser-native tooltips for code and notable hover #111856
Conversation
This is the simplest way to adopt the timing guidelines described in <https://www.nngroup.com/articles/timing-exposing-content/>. It replaces the mouseover interactions used for "tooltip" popovers with HTML `title` attributes, which already do the right thing. The JavaScript-based popover code remains for click interaction, so that these elements remain accessible on touch screens, and because it's not possible to put links in native tooltips.
(rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @Folyd, @jsha |
I'm not sure having two "views" for the same tooltip is a good idea. Also, what's the size difference in the std? What do you think about this @rust-lang/rustdoc ? |
I find it rather useful that the tooltip content is clickable. I would rather have us implement the timing requirements. |
How about, instead, getting rid of the |
I find the hover to be quite useful as a hover. I'm not strongly opposed but I would prefer to retain the hover. |
@Manishearth Is something like #111892 more what you want? |
Looking at the preview, yeah, that looks better. From the guidelines we may want to introduce some instant non-popup hover interaction to the ℹ️, similar to what we have going on with the panic interface, so that people know that an interaction has "registered". Perhaps give it a more muted color that becomes darker, or just make the existing color darker, or give it a shadow, or something. |
FWIW I was searching around for some resources on tooltips and found this page which advises against using "title" to make tooltips. A nice vindication of the conclusion already reached in this PR: |
This is the simplest way to adopt the timing guidelines described in https://www.nngroup.com/articles/timing-exposing-content/. It replaces the mouseover interactions used for "tooltip" popovers with HTML
title
attributes, which already do the right thing.The JavaScript-based popover code remains for click interaction, so that these elements remain accessible on touch screens, and because it's not possible to put links in native tooltips.
Preview
On-hover tooltip for notable traits
On-click popup tip for notable traits (unchanged)