fix(controller): clean up INTERACTIVE_ARIA_ATTRS
This commit is contained in:
@@ -1144,36 +1144,22 @@ export default (
|
|||||||
* @returns {boolean} Whether the element is an interactive candidate.
|
* @returns {boolean} Whether the element is an interactive candidate.
|
||||||
*/
|
*/
|
||||||
const INTERACTIVE_ARIA_ATTRS = [
|
const INTERACTIVE_ARIA_ATTRS = [
|
||||||
'aria-label',
|
|
||||||
'aria-labelledby',
|
|
||||||
'aria-describedby',
|
|
||||||
'aria-expanded',
|
'aria-expanded',
|
||||||
'aria-checked',
|
'aria-checked',
|
||||||
'aria-selected',
|
'aria-selected',
|
||||||
'aria-pressed',
|
'aria-pressed',
|
||||||
'aria-hidden',
|
|
||||||
'aria-haspopup',
|
'aria-haspopup',
|
||||||
'aria-controls',
|
'aria-controls',
|
||||||
'aria-owns',
|
'aria-owns',
|
||||||
'aria-current',
|
|
||||||
'aria-disabled',
|
|
||||||
'aria-live',
|
|
||||||
'aria-modal',
|
|
||||||
'aria-activedescendant',
|
'aria-activedescendant',
|
||||||
'aria-valuenow',
|
'aria-valuenow',
|
||||||
'aria-valuetext',
|
'aria-valuetext',
|
||||||
'aria-valuemax',
|
'aria-valuemax',
|
||||||
'aria-valuemin',
|
'aria-valuemin',
|
||||||
'aria-autocomplete',
|
'aria-autocomplete',
|
||||||
'aria-invalid',
|
|
||||||
'aria-required',
|
|
||||||
'aria-level',
|
|
||||||
'aria-sort',
|
|
||||||
'aria-orientation',
|
|
||||||
'aria-multiline',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
function hasAriaAttribute(el) {
|
function hasInteractiveAria(el) {
|
||||||
for (let i = 0; i < INTERACTIVE_ARIA_ATTRS.length; i++) {
|
for (let i = 0; i < INTERACTIVE_ARIA_ATTRS.length; i++) {
|
||||||
if (el.hasAttribute(INTERACTIVE_ARIA_ATTRS[i])) return true
|
if (el.hasAttribute(INTERACTIVE_ARIA_ATTRS[i])) return true
|
||||||
}
|
}
|
||||||
@@ -1204,7 +1190,7 @@ export default (
|
|||||||
element.hasAttribute('onclick') ||
|
element.hasAttribute('onclick') ||
|
||||||
element.hasAttribute('role') ||
|
element.hasAttribute('role') ||
|
||||||
element.hasAttribute('tabindex') ||
|
element.hasAttribute('tabindex') ||
|
||||||
hasAriaAttribute(element) ||
|
hasInteractiveAria(element) ||
|
||||||
element.hasAttribute('data-action') ||
|
element.hasAttribute('data-action') ||
|
||||||
element.getAttribute('contenteditable') === 'true'
|
element.getAttribute('contenteditable') === 'true'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user