Skip to content
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

Accessibility - Use modifiers for chapter nav and add shortkey settings #2061

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lionel-rowe
Copy link

@lionel-rowe lionel-rowe commented Apr 13, 2023

Fixes #518 and #1789. Supersedes #2043.

This PR changes the default chapter navigation key combos from bare and to Ctrl+ and Ctrl+ (Windows) or + and + (Mac). The bare arrow key combos are bad for accessibility and very easy to press by mistake for users who expect arrow keys to scroll the page, which is the usual and expected behavior. Hitboxes of the chapter navigation buttons are also reduced to prevent accidental clicks.

It also adds options to make all shortkeys user-configurable. These options are included in the new Settings menu, which also allows for setting the theme and takes the place of the Theme menu in the menu bar. The new options make it easy for users to switch back to the old behavior if desired or choose their own key combinations to avoid any functionality clashes with screen readers, browser extensions, or other 3rd-party software.

Shortcuts for all keyboard-accessible elements are also surfaced to users on hover by appending them to the title of the relevant elements, and to assistive software by setting aria-keyshortcuts.

The options also allow configuring the shortkeys for Toggle Table of Contents, Search, and Open settings.

Finally, all shortkeys are temporarily disabled whenever the currently focused element is an input, textarea, or is contentEditable. This should fix issues of unexpected behavior in books that use custom editable elements.

image

image

@expikr
Copy link
Contributor

expikr commented Apr 13, 2023

Works great! Inputs are correctly respected, indeed even when I changed the shortcut to bare left/right it is still working correctly.

@expikr
Copy link
Contributor

expikr commented Apr 13, 2023

I rather like the old theme selector that lets me switch themes with one click.

I think it would be better if the theme button is left as it currently is, and instead add an extra gear icon in the sidebar's bottom-left like so:

image

This placement signals that it's for general options about the whole reader, rather than something specific to the content like themes are.

@lionel-rowe
Copy link
Author

I think it would be better if the theme button is left as it currently is, and instead add an extra gear icon in the sidebar's bottom-left ...
This placement signals that it's for general options about the whole reader, rather than something specific to the content like themes are.

I agree that simplicity is desirable, and I'm open to making changes, but I don't really follow the logic here — themes are also global to the reader rather than just the content, and placing settings under the ToC gives the false impression that the settings related to the ToC. It also makes the settings difficult to discover for books with ToCs taller than the screen height, unless the settings icon is a fixed element that obscures the bottom of the ToC. I also don't think people would typically expect to find settings in the bottom left corner, based on established UX patterns.

I'll wait for feedback from maintainers before making any further substantive changes.

@expikr
Copy link
Contributor

expikr commented Apr 15, 2023

I don't mean that themes aren't global, rather the emphasis is that an "all the other options" menu is better placed somewhere that signals it encompassing options that may fall outside of the content scope -- that's what I meant by it being "general to the reader", it prospects for future additions to the menu without cluttering up the theme selector more and more.

My main concern is just needing the accessibility the guarantee that any mdbook webpage I visit will have the theme dropdown in one click and at the same place -- having to visually search through a cumbersome menu while my eyes are being seared is not a good experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: waiting on a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] make keyboard nav optional
3 participants