From 3efef0ec42c9210c22a18a0ee32656328c1759d3 Mon Sep 17 00:00:00 2001 From: Simon <10131203+gaomeng1900@users.noreply.github.com> Date: Thu, 2 Apr 2026 17:33:27 +0800 Subject: [PATCH] fix(controller): clean up `INTERACTIVE_ARIA_ATTRS` --- .../page-controller/src/dom/dom_tree/index.js | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/packages/page-controller/src/dom/dom_tree/index.js b/packages/page-controller/src/dom/dom_tree/index.js index 9166612..ccfdd1b 100644 --- a/packages/page-controller/src/dom/dom_tree/index.js +++ b/packages/page-controller/src/dom/dom_tree/index.js @@ -1144,36 +1144,22 @@ export default ( * @returns {boolean} Whether the element is an interactive candidate. */ const INTERACTIVE_ARIA_ATTRS = [ - 'aria-label', - 'aria-labelledby', - 'aria-describedby', 'aria-expanded', 'aria-checked', 'aria-selected', 'aria-pressed', - 'aria-hidden', 'aria-haspopup', 'aria-controls', 'aria-owns', - 'aria-current', - 'aria-disabled', - 'aria-live', - 'aria-modal', 'aria-activedescendant', 'aria-valuenow', 'aria-valuetext', 'aria-valuemax', 'aria-valuemin', '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++) { if (el.hasAttribute(INTERACTIVE_ARIA_ATTRS[i])) return true } @@ -1204,7 +1190,7 @@ export default ( element.hasAttribute('onclick') || element.hasAttribute('role') || element.hasAttribute('tabindex') || - hasAriaAttribute(element) || + hasInteractiveAria(element) || element.hasAttribute('data-action') || element.getAttribute('contenteditable') === 'true'