Forráskód Böngészése

无障碍feat:重复按按快捷键,可以重复选中页面结构区域

任一存 3 éve
szülő
commit
53dbcbbe48
1 módosított fájl, 6 hozzáadás és 0 törlés
  1. 6 0
      web/src/utils.js

+ 6 - 0
web/src/utils.js

@@ -167,7 +167,13 @@ function getAndFocusNextNodeWithCustomAttribute(attriName) {
   }
 
   if (targetNode) {
+    // 如果重复选中某一区域,需要重新触发focus,所以先blur一下
+    if (document.activeElement === targetNode) {
+      targetNode.blur()
+    }
     targetNode.focus()
+
+    // 如果无法focus,就强行focus
     if (document.activeElement !== targetNode) {
       targetNode.setAttribute('tabindex', '0')
       targetNode.focus()