-
Notifications
You must be signed in to change notification settings - Fork 87
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
Search bar navigation #1088
Search bar navigation #1088
Conversation
Thanks, that a much improved user experience! Small feedback from using it:
|
This is fixed
This is done as well
I wanted to be too much like github : my attempt was "🔎 Type [/] to search" which looked ugly. This is now done, thanks. |
function enter_focus() { | ||
if (n_focus === null) return; | ||
let elt = current_result(); | ||
elt.click(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function seems unused
&& (ascii >= 65 && ascii <= 90) // lowercase letter | ||
|| (ascii >= 97 && ascii <= 122) // uppercase letter | ||
|| (ascii >= 48 && ascii <= 57) // numbers | ||
|| (ascii >= 32 && ascii <= 46) // ` ` to `.` | ||
|| (ascii >= 58 && ascii <= 64) // `:` to `@` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we want that all those ascii characters trigger search...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nitpick) It would be nice if the focus were teleported to the input when typing again:
This is done as well
Ah, maybe this was due to this! But typing on any ascii character even outside of search triggers search, maybe that is too much?
Navigation is working but css needs work.
Revert CSS changes because focus already has its CSS.
051e109
to
0056bc6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks!
The odoc search bar does have navigation : you cannot use the arrow keys to select a search result.
This add javascript that allows this.
There is also a shortcut to enter search :
/
and to exit :escape
.Escape is very intuitive, an
/
is also used by other website like github or discuss.There should no diff on css, as the js uses the focus mechanism and there was css for that already.
I am thinking of adding a visual cue that
/
focuses the search bar. Github has one, but I am not very happy with what I came up with. Ideas and help are welcome.