Skip to content

Commit 877c35e

Browse files
committed
Ignore all negative tabindex values.
While there isn't really any reasonable reason to do so, tabindex can be set to any negative value in order to remove it from the sequential keyboard navigation. Since it is in the spec, and it is very easy to write an adequate selector, there seems to be no reason not to support it.
1 parent 94a971b commit 877c35e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

accessible-modal-dialog.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// Helper function to get all focusable children from a node
55
function getFocusableChildren (node) {
6-
var focusableElements = ['a[href]', 'area[href]', 'input:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'iframe', 'object', 'embed', '[contenteditable]', '[tabindex]:not([tabindex="-1"])'];
6+
var focusableElements = ['a[href]', 'area[href]', 'input:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'iframe', 'object', 'embed', '[contenteditable]', '[tabindex]:not([tabindex^="-"])'];
77

88
return $$(focusableElements.join(','), node).filter(function (child) {
99
return !!(child.offsetWidth || child.offsetHeight || child.getClientRects().length);

accessible-modal-dialog.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// Helper function to get all focusable children from a node
55
function getFocusableChildren (node) {
6-
var focusableElements = ['a[href]', 'area[href]', 'input:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'iframe', 'object', 'embed', '[contenteditable]', '[tabindex]:not([tabindex="-1"])'];
6+
var focusableElements = ['a[href]', 'area[href]', 'input:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'iframe', 'object', 'embed', '[contenteditable]', '[tabindex]:not([tabindex^="-"])'];
77

88
return $$(focusableElements.join(','), node).filter(function (child) {
99
return !!(child.offsetWidth || child.offsetHeight || child.getClientRects().length);

0 commit comments

Comments
 (0)