about summary refs log tree commit diff
path: root/src/test/incremental/thinlto
diff options
context:
space:
mode:
authorJacob Hoffman-Andrews <github@hoffman-andrews.com>2021-05-09 12:56:21 -0700
committerJacob Hoffman-Andrews <github@hoffman-andrews.com>2021-05-13 12:49:14 -0700
commitb615c0c85469c94041a5e68b9d8b68dcf799f9f1 (patch)
tree4406ac781e0ba2b7b2fd0d37e06c341f4b2fe4d8 /src/test/incremental/thinlto
parent952c5732c2d25a875f90e5cd5dd29a1a21c1d4a2 (diff)
downloadrust-b615c0c85469c94041a5e68b9d8b68dcf799f9f1.tar.gz
rust-b615c0c85469c94041a5e68b9d8b68dcf799f9f1.zip
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 focused element.
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.
Diffstat (limited to 'src/test/incremental/thinlto')
0 files changed, 0 insertions, 0 deletions