|
@@ -477,9 +477,8 @@ export default {
|
|
|
interactionAreaNum: null,
|
|
|
|
|
|
// 为了避免多余的朗读行为
|
|
|
- isJustMouseDown: false,
|
|
|
- domChangeLastTime: null,
|
|
|
- mutationObserver: null,
|
|
|
+ mouseDownLastTime: null,
|
|
|
+ keyEnterLastTime: null,
|
|
|
requestReadLastTime: null,
|
|
|
isJustWindowFocus: false,
|
|
|
}
|
|
@@ -680,13 +679,6 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
- const config = { attributes: true, childList: true, subtree: true };
|
|
|
- const callback = (mutationsList, observer) => {
|
|
|
- this.domChangeLastTime = Date.now()
|
|
|
- };
|
|
|
- this.mutationObserver = new MutationObserver(callback);
|
|
|
- this.mutationObserver.observe(document.body, config);
|
|
|
},
|
|
|
mounted() {
|
|
|
},
|
|
@@ -721,7 +713,6 @@ export default {
|
|
|
this.$eventBus.$off('request-process-text-element')
|
|
|
this.$eventBus.$off('request-process-image-element')
|
|
|
|
|
|
- this.mutationObserver.disconnect();
|
|
|
},
|
|
|
methods: {
|
|
|
onWindowFocus() {
|
|
@@ -738,10 +729,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
onMouseDown() {
|
|
|
- this.isJustMouseDown = true
|
|
|
- setTimeout(() => {
|
|
|
- this.isJustMouseDown = false
|
|
|
- }, 0);
|
|
|
+ this.mouseDownLastTime = Date.now()
|
|
|
},
|
|
|
planToPlayAudio(taskId, text = '') {
|
|
|
let XHR = new XMLHttpRequest()
|
|
@@ -784,6 +772,9 @@ export default {
|
|
|
if (e.repeat) {
|
|
|
return
|
|
|
}
|
|
|
+ if (e.key === 'Enter') {
|
|
|
+ this.keyEnterLastTime = Date.now()
|
|
|
+ }
|
|
|
if (e.key === "?" && !e.altKey && !e.ctrlKey && e.shiftKey) {
|
|
|
if (this.ariaSettings.isCompActive) {
|
|
|
this.onClickHelp()
|
|
@@ -904,11 +895,15 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
const curTime = Date.now()
|
|
|
- if (curTime - this.domChangeLastTime <= 500 + 100) {
|
|
|
- console.log('DOM刚改变,忽略hover。');
|
|
|
+ if (curTime - this.mouseDownLastTime <= 500 + 200) {
|
|
|
+ console.log('刚发生mousedown,忽略hover。');
|
|
|
return
|
|
|
}
|
|
|
- if (curTime - this.requestReadLastTime <= 500 + 100) {
|
|
|
+ if (curTime - this.keyEnterLastTime <= 500 + 200) {
|
|
|
+ console.log('刚发生mousedown,忽略hover。');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (curTime - this.requestReadLastTime <= 500 + 200) {
|
|
|
console.log('刚被要求朗读,忽略hover。');
|
|
|
return
|
|
|
}
|
|
@@ -925,11 +920,15 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
const curTime = Date.now()
|
|
|
- if (curTime - this.domChangeLastTime <= 100) {
|
|
|
- console.log('DOM刚改变,忽略hover。');
|
|
|
+ if (curTime - this.domChangeLastTime <= 200) {
|
|
|
+ console.log('刚发生mousedown,忽略hover。');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (curTime - this.keyEnterLastTime <= 200) {
|
|
|
+ console.log('刚发生mousedown,忽略hover。');
|
|
|
return
|
|
|
}
|
|
|
- if (curTime - this.requestReadLastTime <= 100) {
|
|
|
+ if (curTime - this.requestReadLastTime <= 200) {
|
|
|
console.log('刚被要求朗读,忽略hover。');
|
|
|
return
|
|
|
}
|
|
@@ -978,7 +977,8 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
// 如果是点击鼠标引起的focus
|
|
|
- if (this.isJustMouseDown) {
|
|
|
+ const curTime = Date.now()
|
|
|
+ if (curTime - this.mouseDownLastTime < 200) {
|
|
|
if (
|
|
|
document.activeElement.dataset.ariaNavigationArea !== undefined ||
|
|
|
document.activeElement.dataset.ariaViewportArea !== undefined ||
|