rust/src/librustdoc/html
Dylan DPC 453fc03597
Rollup merge of #111892 - notriddle:notriddle/timeout-tooltip, r=me,GuillaumeGomez,Manishearth
rustdoc: add interaction delays for tooltip popovers

Preview:

* [notable traits](http://notriddle.com/rustdoc-demo-html-3/delay-tooltip/testing/struct.Vec.html#method.iter)
* [panicking code block](http://notriddle.com/rustdoc-demo-html-3/delay-tooltip/testing/struct.Vec.html#indexing)

Designing a good hover microinteraction is a matter of guessing user intent from what are, literally, vague gestures. In this case, guessing if hovering in our out of the tooltip base is intentional or not.

To figure this out, a few different techniques are used:

* When the mouse pointer enters a tooltip anchor point, its hitbox is grown on the bottom, where the popover is/will appear. This was already there before this commit: search "hover tunnel" in rustdoc.css for the implementation.

* This commit adds a delay when the mouse pointer enters the base anchor, in case the mouse pointer was just passing through and the user didn't want to open it.

* This commit also adds a delay when the mouse pointer exits the tooltip's base anchor or its popover, before hiding it.

* A fade-out animation is layered onto the pointer exit delay to immediately inform the user that they successfully dismissed the popover, while still providing a way for them to cancel it if it was a mistake and they still wanted to interact with it.

* No animation is used for revealing it, because we don't want people to try to interact with an element while it's in the middle of fading in: either they're allowed to interact with it while it's fading in, meaning it can't serve as mistake- proofing for opening the popover, or they can't, but they might try and be frustrated.

See also:

* https://www.nngroup.com/articles/timing-exposing-content/
* https://www.nngroup.com/articles/tooltip-guidelines/
* https://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown
2023-06-01 11:09:43 +05:30
..
highlight rustdoc: rename syntax highlighting CSS class attribute to attr 2022-10-31 13:55:39 -07:00
length_limit Remove from librustdoc and clippy too 2023-01-27 20:44:19 -08:00
markdown rustdoc: account for intra-doc links in <meta name="description"> 2023-02-11 16:10:28 -07:00
render Rollup merge of #112113 - notriddle:notriddle/rm-fnretty, r=GuillaumeGomez 2023-05-31 07:07:03 +02:00
static rustdoc: add jsdoc comments for complex functions 2023-05-31 17:25:06 -07:00
templates Add ItemTemplate trait 2023-05-25 20:31:56 +08:00
toc Format the world 2019-12-22 17:42:47 -05:00
url_parts_builder Document and test UrlPartsBuilder::push_fmt 2022-01-14 12:05:35 -08:00
escape.rs Remove crate visibility modifier in libs, tests 2022-05-21 00:32:47 -04:00
format.rs rustdoc: simplify clean by removing FnRetTy 2023-05-30 12:22:14 -07:00
highlight.rs initial step towards implementing C string literals 2023-05-02 10:30:09 +00:00
layout.rs rustdoc: remove meta keywords from HTML 2023-01-30 12:20:06 -07:00
length_limit.rs Remove from librustdoc and clippy too 2023-01-27 20:44:19 -08:00
markdown.rs Rollup merge of #108459 - benediktwerner:rustdoc-fix-link-match, r=GuillaumeGomez 2023-06-01 11:09:42 +05:30
mod.rs Remove crate visibility modifier in libs, tests 2022-05-21 00:32:47 -04:00
sources.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
static_files.rs Inline CSS background images directly into the CSS 2023-02-01 11:51:02 +01:00
tests.rs rustdoc: avoid many Symbol to String conversions. 2022-01-14 11:57:18 -08:00
toc.rs fix clippy perf lints 2022-05-24 13:35:54 -04:00
url_parts_builder.rs Remove crate visibility modifier in libs, tests 2022-05-21 00:32:47 -04:00