Skip to content

Commit

Permalink
fix: always set tabIndex to restore keydown a11y (#6871)
Browse files Browse the repository at this point in the history
Skipping the tabIndex property on created elements due to #6145
optimizations blocks them from receiving keyboard events, due to not
being focusable; for example this breaks closing ModalDialog elements by
pressing Escape.
Fix this by always setting tabIndex, as the element may return the same
value even though the property has not been explicitly set.

Fixes #6870
  • Loading branch information
zmousm authored Nov 10, 2020
1 parent 8617530 commit 0140b28
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/utils/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export function createEl(tagName = 'div', properties = {}, attributes = {}, cont
// method for it.
} else if (propName === 'textContent') {
textContent(el, val);
} else if (el[propName] !== val) {
} else if (el[propName] !== val || propName === 'tabIndex') {
el[propName] = val;
}
});
Expand Down

0 comments on commit 0140b28

Please sign in to comment.