-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add keyboard navigation #1095
Add keyboard navigation #1095
Conversation
This is a nice feature to have. Thanks for the contribution. I noticed that both the Finally, I appears that the pypy3 tests failed (on Travis) due to an error creating the envs. I restarted them, but the outcome was the same. In any even, the problem does not appear to be related to this PR. Even more curious is that the appveyor tests were never even triggered. Again, it does not appear to be an issue with this PR, but we may have some new issues with our automation setup. Sigh. |
I can remove the No idea about the Travis failure, it's only a little JS! |
I would prefer we use whatever is common. Other than my quick search which tuned up what Sphinx does, I have no idea what other projects use for this use case. In my experience, many apps us |
I should add that In contrast, the vim shortcuts apparently come from the ADM-3A keyboard layout, where the Regardless, I think it makes sense to leave the arrow keys support as it is now. |
Another option is that arrows could be default with a setting in |
BTW - Gmail uses |
Let's not add any more settings. Really, Gmail uses |
Yes, vimmy |
Okay, I see three options:
I'm partial to 1 or 3 but would be willing to accept whichever one gets built. |
3 seems best to me. I don't understand why it wouldn't work on |
1 or 3 is fine. Maybe even 1 now as it is easy then 3 later. |
59182e5
to
88de372
Compare
abadc03
to
8f78c0a
Compare
@mreinhardt Wow. Looks good at a glance. I'll take a closer look later. However, you are getting a few minor csslint failures. You can ignore the other (pypy3) failures as they are not related to this PR. |
8f78c0a
to
8682d8a
Compare
@waylan Installed tox and csslint and fixed issues. |
I know it's unrelated, but is there anything I can do to help fix the other tests? |
The other failures appears to be an incompatibility between the latest version of pip (or one of its dependencies) and pypy3. The failure is happening in environment creation, long before our tests are run. Not sure what can be done about that as we don't get to pick which version of pip gets installed in each environment (at least I'm not aware of a way). Hopefully either pip or pypy3 will get a quick update which resolves the problem. Otherwise, I'm not sure what the best approach is here. In any event, sorry but I just haven't had time to look closely at your changes in this PR yet. Hopefully I'll get to it sometime this week. |
I took a closer look and overall I think this looks good. However, there are a couple minor issues. First of all the table in the modal needs adjusted in the The other issue is a little more of a problem. The modal works fine except when you use one of the shortcuts before closing the modal (yes, the normal ways of closing the modal works such as the As you can see, I've started to type a search term and the browser's history feature also shows a dropdown of past search terms. It would be preferable if the modal had closed when I hit the shortcut. However, even more concerning is the In that case, the search modal appears behind the shortcut modal (the darkened background actually doubles in darkness). And even stranger, the search box has focus and you can type a search term and get results (and the browser shows search history), all while the search modal is hidden behind the shortcut modal. If you use the normal methods for closing the shortcut modal, then the search modal is properly visible. This is clearly a broken user interface. I could live with the other issues, but this needs to be fixed. I will add that the other shortcuts are not an issue as the navigation shortcuts load another page and the modal gets reset anyway. I see a few possible solutions:
I think option 3 probably makes the most sense. AFAICT, this is the behavior used by GMail. And perhaps we should list Finally, the up/down arrow keys do nothing in the |
Something keeps bothering me about this. The A bonus is that we would not need to develop and maintain a complete modal system for the |
@waylan Sounds good. Will only use |
8682d8a
to
12a65f1
Compare
@waylan Amended commit with requested fixes. |
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. The search/help modal weirdness is resolved sufficiently. I still wonder if all keyboard shortcuts should be disabled when any modal is open, but this is a clean alternative and probably easier to implement.
I really liked being able to completely navigate through the entire site only from the keyboard. Address the few minor issues I highlighted inline and this should be ready to go.
Thanks for doing the work on this.
mkdocs/themes/mkdocs/js/base.js
Outdated
page = $('[role="navigation"] a:contains(Previous):first').prop('href'); | ||
break; | ||
case 83: // s | ||
if (e.altKey) { |
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.
Curious why you saw the need to require the Alt
key here? I'm fine with it, just wondering why we can't use an s
alone.
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.
Umm, good question! I don't remember. Just s
seems fine, will change.
<td>Open this help</td> | ||
</tr> | ||
<tr> | ||
<td><kbd>←</kbd></td> |
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.
Perhaps we should use the HTML entity (←
) rather than the Unicode character in the template. With the proper encoding the Unicode character should work, but the HTML entity is less likely to break across various platforms, browsers, servers, etc.
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.
You got it.
<td>Previous page</td> | ||
</tr> | ||
<tr> | ||
<td><kbd>→</kbd></td> |
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.
And this should be the HTML entity →
.
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.
🆗
<td>Next page</td> | ||
</tr> | ||
<tr> | ||
<td><kbd>Alt</kbd>+<kbd>s</kbd></td> |
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 noticed that the plus sign looks out-of-line (vertically) with the Alt
and s
keys. Its a nitpick, but it would be nice to get it right.
Actually, as per this, you should have:
<td><kbd><kbd>Alt</kbd>+<kbd>s</kbd></kbd></td>
That way, the plus sign is still in the outer kbd
element, but separate from the actual keys in the inner kdb
elements. Then just apply the key styling to the inner elements. That may resolve the issue itself. If not, then it at least provides an extra styling hook.
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.
Removing Alt
in shortcut so this will go away, but good to know.
Oh, one more thing, if you rebase against the upstream master branch, then the failing tests will go away as we've addressed that issue. |
Will do! |
12a65f1
to
42e22aa
Compare
@waylan All done! (I hope.) |
I'm happy with this. It just needs to be added to the Rease Notes. However, we haven't added a section for the next release yet. I expect we'll probably do a bug-fix release or two before our next point release. Actually the next point release will probably be 1.0.0, and this has been assigned to that milestone so we won't forget it. |
Excellent, cheers! |
Hmm, looks like I forgot about this. @mreinhardt if you update this to the current state in master, I'll merge this in. |
this is no longer the email address for @mreinhardt
he no longer works here
…On Tue, Oct 3, 2017 at 7:18 AM, Waylan Limberg ***@***.***> wrote:
Hmm, looks like I forgot about this. @mreinhardt
<https://github.com/mreinhardt> if you update this to the current state
in master, I'll merge this in.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1095 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAjjPSCZGeCMu_7Ss6C1pjhzDbyS4YSRks5sokJJgaJpZM4K0vOJ>
.
--
Mike Jeon
GoodRx, Inc.
VP Finance
(310) 593-9977 (w)
|
Right arrow or
n
for next page. Left arrow orp
for previous page. Disabled when cursor is in an input element.