about summary refs log tree commit diff
path: root/library/std/src/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2021-05-18 19:35:35 +0200
committerGitHub <noreply@github.com>2021-05-18 19:35:35 +0200
commitc9b6bb92798108dfa4f8ae93a961aa95163b2df6 (patch)
tree4e8ab8cd0ffe2ad16886a677c5fdeed2a5651856 /library/std/src/sys/unix/stack_overflow.rs
parenta5560a6a90f08a84728802bb5fa5632a17a78672 (diff)
parentb615c0c85469c94041a5e68b9d8b68dcf799f9f1 (diff)
downloadrust-c9b6bb92798108dfa4f8ae93a961aa95163b2df6.tar.gz
rust-c9b6bb92798108dfa4f8ae93a961aa95163b2df6.zip
Rollup merge of #84462 - jsha:focus-search-results2, r=GuillaumeGomez
rustdoc: use focus for search navigation

Rather than keeping track of highlighted element inside the JS, take advantage of `.focus()` and the :focus CSS pseudo-class.

This required wrapping each row of results in one big `<a>` tag (because anchors can be focused, but table rows cannot). That in turn required moving from a table layout to a div layout with float.

This makes it so Ctrl+Enter opens links in new tabs, and using the arrow keys to navigate off the bottom of the page scrolls the rest of the page into view. It also simplifies the keyboard event handling. It eliminates the need for click handlers on the search results, and for tracking mouse movements.

This changes the UI treatment of mouse hovering. A hovered element now gets a light grey background, but does not change the focus. It's possible to have two highlighted search results: one that is focused (via keyboard) and one that is hovered (via mouse). Pressing enter will activate the focused link; clicking will activate the hovered link. This matches up with how Firefox and Chrome handle suggestions in their URL bar, and avoids stray mouse movements changing the focus.

Selecting tabs is now done with left/right arrows while any search result is focused. The visibility of results on each search tab is
controlled with the "active" class, rather than by setting display: none directly. Note that the old code kept track of highlighted search element when tabbing back and forth. The new code doesn't.

Demo at https://hoffman-andrews.com/rust/focus-search-results2/std/?search=fn

Fixes #84384
Fixes #79962
Fixes #79872
Diffstat (limited to 'library/std/src/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions