区分按键并在NVDA处于打开状态时在Mozilla中单击 [英] Distinguish the keypress and click in Mozilla when NVDA is ON
问题描述
要求是区分Mozilla浏览器中的按键和鼠标单击事件.条件是当 NVDA开启
Requirement is to distinguish the keypress and mouse click events in Mozilla browser. The condition is that the Mozilla browser should be able to distinguish the events (click and enter) when the NVDA IS TURNED ON
推荐答案
如果您只是想区分Enter/空格键和鼠标/指针键,我可能会同时使用onclick
和onmousedown
.
If you're only looking to distinguish between Enter/Space press and mouse/pointer press, I would probably go for using both an onclick
and an onmousedown
.
如果触发了onmousedown
,我将设置一个标志,以读取onclick
,告诉我这是否实际上是指针事件.
If the onmousedown
is fired, I would set a flag, that I would read in the onclick
, telling me whether this was actually originally a pointer event.
类似的东西:
<button onmousedown="pointerFunction()" onclick="clickFunction()">Active this</button>
<script>
var isPointerEvent = false;
function pointerFunction() {
isPointerEvent = true;
// Do something for pointer users
}
function clickFunction() {
if (isPointerEvent) {
return isPointerEvent = false;
}
// Do something for keyboard / screen-reader users
}
</script>
为记录起见,我在此处针对类似问题发表了相同的建议: https://stackoverflow.com/a/57055357/10494842
For the record, I posted the same suggestion here for a similar question: https://stackoverflow.com/a/57055357/10494842
这篇关于区分按键并在NVDA处于打开状态时在Mozilla中单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!