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

Tabables doesn't include anchors <a> #181

Open
tmorehouse opened this issue Apr 25, 2019 · 3 comments
Open

Tabables doesn't include anchors <a> #181

tmorehouse opened this issue Apr 25, 2019 · 3 comments

Comments

@tmorehouse
Copy link

The focus enforcement list of tabbale items ('button', 'input', 'keygen', 'select', 'textarea') should also include anchors with that have an href attribute a[href]

var opts = ['button', 'input', 'keygen', 'select', 'textarea'];

Should probably be:

var opts = ['button', 'input', 'keygen', 'select', 'textarea', 'a[href]`];
@samthor
Copy link
Contributor

samthor commented Apr 25, 2019 via email

@tmorehouse
Copy link
Author

For ARIA accessibility, it is always best to focus the dialog element (when first opened), so the user has context of where they are, rather than being stranded on a tabable element, not knowing the context of where they are.

And when tabbing through the dialog, it should cycle focus through the tabables, and when reacing hte end of the tabable list, cycle back to the first tabable (excluding the dialog). Shift tab on the first tabable (or dialog element) should focus the last tabable in the dialog.

The enforce focus (for modal dialogs) can be implemented by adding a focusout handler on the modal dialog, looking at evt.target, and evt.relatedTarget. If evt.relatedTarget is outside of the dialog (!this.dialog.contains(evt.relatedTarget)), then use evt.target to determine if the first or last tabable should be focused.

this.dialog.querySelectorAll(..) can be used to get a list of all tabables, then sort (stableSort) based on element.tabIndex (as some silly people may use tabindexs > 0) to determine the order of the tabables

Also, the list of tabables should be filtered for visibility (i.e. not display: none)

@jelmerdemaat
Copy link

I have made this PR solving this issue: #228

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants