瀏覽代碼

优化读屏逻辑:某些操作刚结束后不处理被动触发的mouseover事件

任一存 3 年之前
父節點
當前提交
3c27da5529
共有 2 個文件被更改,包括 25 次插入1 次删除
  1. 1 1
      web/src/config.js
  2. 24 0
      web/src/views/accessibility.vue

+ 1 - 1
web/src/config.js

@@ -9,7 +9,7 @@ switch (process.env.NODE_ENV) {
     break;
 }
 
-const version = 'v0519.1049'
+const version = 'v0520.1222'
 
 module.exports = {
   publicPath,

+ 24 - 0
web/src/views/accessibility.vue

@@ -478,6 +478,9 @@ export default {
 
       focusedNode: null,
       focudedNodeTimeoutId: null,
+
+      // 做有些操作如新打开页面、切换无障碍菜单模式时,会被动地导致mouseover事件,此时不希望做响应。
+      ignoreMouseOver: false,
     }
   },
   watch: {
@@ -614,6 +617,11 @@ export default {
     },
   },
   created() {
+    this.ignoreMouseOver = true
+    setTimeout(() => {
+      this.ignoreMouseOver = false
+    }, 1000);
+    
     this.loadStoredSettings()
     // 在同一个域的多个页面间做同步
     window.addEventListener('storage', this.loadStoredSettings, {
@@ -848,6 +856,9 @@ export default {
       if (!this.ariaSettings.isCompActive) {
         return
       }
+      if (this.ignoreMouseOver) {
+        return
+      }
       const extractedText = utils.extractTextForMagnify(e)
       if (extractedText) {
         this.elemType = extractedText.elemType
@@ -865,6 +876,9 @@ export default {
       if (!this.ariaSettings.isCompActive) {
         return
       }
+      if (this.ignoreMouseOver) {
+        return
+      }
       const extractedText = utils.extractTextForMagnify(e)
       if (extractedText) {
         this.elemType = extractedText.elemType
@@ -1026,10 +1040,20 @@ export default {
       this.planToPlayAudio('', "You are downloading the shortcut. Double click the shortcut to reach the website.")
     },
     onClickElderlyServicesAreaEntry() {
+      this.ignoreMouseOver = true
+      setTimeout(() => {
+        this.ignoreMouseOver = false
+      }, 1000);
+
       this.ariaSettings.menuMode = 'old'
       this.planToPlayAudio('', "You've switched to the elderly services mode.")
     },
     onClickScreenReaderAreaEntry() {
+      this.ignoreMouseOver = true
+      setTimeout(() => {
+        this.ignoreMouseOver = false
+      }, 1000);
+
       this.ariaSettings.menuMode = 'blind'
       this.planToPlayAudio('', "You've switched to screen the reading accessibility mode.")
     },