rust/src/librustdoc
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
..
clean rustdoc: simplify clean by removing FnRetTy 2023-05-30 12:22:14 -07:00
doctest pass unused_extern_crates in librustdoc::doctest::make_test 2023-04-25 17:20:58 +03:00
formats Rollup merge of #112018 - GuillaumeGomez:cleanup-tcx, r=notriddle 2023-05-27 20:40:29 +02:00
html Rollup merge of #111892 - notriddle:notriddle/timeout-tooltip, r=me,GuillaumeGomez,Manishearth 2023-06-01 11:09:43 +05:30
json rustdoc: simplify clean by removing FnRetTy 2023-05-30 12:22:14 -07:00
passes Use Cow in {D,Subd}iagnosticMessage. 2023-05-29 09:23:43 +10:00
theme Spelling librustdoc 2023-04-16 21:44:12 -04:00
askama.toml Remove unneeded minus sign in jinja tags 2023-03-06 11:38:15 +01:00
Cargo.toml rustdoc: DocFS: Replace rayon with threadpool and enable it for all targets 2023-03-14 20:28:00 +01:00
config.rs Rollup merge of #109084 - dekrain:fix-panic-arg0-expansion, r=petrochenkov 2023-05-27 20:40:27 +02:00
core.rs rustdoc: Cleanup doc string collapsing 2023-05-22 19:35:35 +03:00
docfs.rs Update docsfs module documentation 2023-03-15 16:47:14 +01:00
doctest.rs rustdoc: Cleanup doc string collapsing 2023-05-22 19:35:35 +03:00
error.rs Remove crate visibility modifier in libs, tests 2022-05-21 00:32:47 -04:00
externalfiles.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
fold.rs clean: Always store enum disriminant. 2023-01-01 18:11:53 +00:00
lib.rs Rollup merge of #109084 - dekrain:fix-panic-arg0-expansion, r=petrochenkov 2023-05-27 20:40:27 +02:00
lint.rs Add rustdoc::unescaped_backtick lint 2023-04-29 13:13:25 +02:00
markdown.rs Turn MarkdownWithToc into a struct with named fields 2023-02-06 16:31:17 +01:00
README.md rust-lang.github.io/rustc-dev-guide -> rustc-dev-guide.rust-lang.org 2020-03-10 17:08:18 -03:00
scrape_examples.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
theme.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
visit.rs clean: Always store enum disriminant. 2023-01-01 18:11:53 +00:00
visit_ast.rs Fix re-export of doc hidden item inside private item not displayed 2023-05-30 20:27:53 +02:00
visit_lib.rs rustdoc: Eliminate remaining uses of resolver 2023-02-13 00:10:15 +04:00

For more information about how librustdoc works, see the rustc dev guide.