-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify keyboard events on docs.rs results #1452
Unify keyboard events on docs.rs results #1452
Conversation
@GuillaumeGomez I would prefer to leave the review with someone knowing more JS than I do, though if this takes too much time I would at least dig into it and validate it works as it should :) |
It was more to get an "overall" review. There are DOM changes after all. ;) |
cd74054
to
490b360
Compare
Updated! |
cc @Nemo157 |
Can you expand on this? What does this PR actually do? |
Instead of simply highlighting an item with a CSS class, we focus it. Meaning that if you press enter, you go to the URL (and if you press ctrl+enter it opens it in another tab). The other change is that pressing 's' is now focusing on the search input of the page (like in rustdoc). Just to be clear: this js isn't on the rustdoc pages so there is no "conflict" between the two in any way. It's on the search pages and the home page of docs.rs. |
@GuillaumeGomez this breaks autocomplete for the search box unfortunately: docs.rs.selection.mp4 |
Just like on rustdoc. Question then: should I disable it on the home page then or should I disable the autocomplete? |
Hmm, it seems unfortunate this is broken for rustdoc to. @Manishearth @jsha do one of you have opinions on what to do here? I kind of lean towards keeping the browser's default behavior. |
Strongly lean towards not overriding browser default behavior |
I'll disable this functionality on the home page then. |
490b360
to
516cc65
Compare
I disabled the usage of arrows on the keyboard (leaving only the escape key). So that means:
|
Does it look good to everyone? |
Ping? |
Considering it's an improvement as it's centralize and make events handling coherent and that all comments were resolved, I'll merge it for the time being then. :) |
@GuillaumeGomez can you please avoid merging PRs without review? It wouldn't have gone out until today anyway, and I don't like bypassing feedback. Now if I find something wrong I have to delay the deploy until this is reverted. |
The keyboard events are suboptimal currently. So I improved them a bit by following what @jsha did in rustdoc. It allows to also centralize the JS in one file and remove the inline JS we currently have. Small demo below:
Peek.2021-07-20.17-26.mp4