Commit 8d5c764
authored
Rollup merge of rust-lang#72968 - integer32llc:docs-arrow-keys, r=GuillaumeGomez
Only highlight doc search results via mouseover if mouse has moved
## What happens
- Go to https://doc.rust-lang.org/stable/std/index.html
- Put your mouse cursor somewhere in the middle where search results will appear and then don't move the mouse
- Press 's' to focus the search box
- Type a query that brings up enough search results to go under where your mouse cursor is
- Press the down arrow
- The search result that is one below where your mouse cursor is will be highlighted.
## What I expected
When not currently using the mouse, I expect doing a search and then pressing the down arrow to always highlight the first search result immediately below the search box.
## The fix
This feels a bit hacky to me; I'm open to other solutions. This introduces a global JS var that keeps track of whether the person searching has moved their mouse after doing a search or not, and only uses the mouse position to highlight search results if the person HAS moved the mouse AFTER doing a search.1 file changed
+24
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
| |||
162 | 164 | | |
163 | 165 | | |
164 | 166 | | |
| 167 | + | |
165 | 168 | | |
166 | 169 | | |
167 | 170 | | |
| |||
424 | 427 | | |
425 | 428 | | |
426 | 429 | | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
427 | 436 | | |
428 | 437 | | |
429 | 438 | | |
| |||
1353 | 1362 | | |
1354 | 1363 | | |
1355 | 1364 | | |
1356 | | - | |
1357 | | - | |
1358 | | - | |
1359 | | - | |
1360 | | - | |
1361 | | - | |
1362 | | - | |
1363 | | - | |
1364 | | - | |
1365 | | - | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
1366 | 1377 | | |
1367 | | - | |
1368 | | - | |
1369 | | - | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
1370 | 1381 | | |
1371 | 1382 | | |
1372 | 1383 | | |
| |||
0 commit comments