Skip to content

Commit

Permalink
utils.js: Make isFocusable return false when tabindex is positive and…
Browse files Browse the repository at this point in the history
… element is disabled (pull#1419)


This change potentially effects any example that uses the isFocusable method in the shared utility scripts (examples/js/utils.js).
Fixes a bug in isFocusable where it returned true for elements with positive tabindex even when the element is disabled.
  • Loading branch information
MartijnCuppens authored Jun 30, 2020
1 parent 2ddb55d commit 3909695
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ aria.Utils.remove = function (item) {
};

aria.Utils.isFocusable = function (element) {
if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute('tabIndex') !== null)) {
return true;
if (element.tabIndex < 0) {
return false;
}

if (element.disabled) {
Expand Down

0 comments on commit 3909695

Please sign in to comment.