Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
374 views
in Technique[技术] by (71.8m points)

javascript - JAWS / IE11中的Keydown事件无法正确触发(Keydown Event in JAWS / IE11 not firing properly)

We are working on fixing some accessibility issues on our video player, one of which is the ability to scrub through the video with the keyboard.(我们正在努力解决视频播放器上的一些可访问性问题,其中之一是可以使用键盘擦洗视频。)

We have the following code, which pauses the video on keydown and scrubs the video forward/backward and then on keyup it plays the video at the new point.(我们有以下代码,它在按下按键时暂停视频并向前/向后擦洗视频,然后在按下按键时在新点播放视频。) The issue is that in IE11 with JAWS the keydown event does not keep firing while the key is held down.(问题在于,在带有JAWS的IE11中,按下键时,按下事件不会持续触发。) It goes back and forth between keydown and keyup.(它在按下和按下之间来回移动。) The result is an endless loop of moving one second forward and then going back to the original point in the video and playing.(结果是一个无尽的循环,向前移动一秒钟,然后返回到视频中的原始点并播放。) Here is the code that we are using currently, is there anything that we can do to make this work with JAWS?(这是我们当前正在使用的代码,我们可以做些什么来使JAWS正常工作吗?) document.addEventListener("keydown", function(ev) { if (ev.keyCode === 37 || ev.keyCode === 39) { console.log("keydown"); } }); document.addEventListener("keyup", function(ev) { if (ev.keyCode === 37 || ev.keyCode === 39) { console.log("keyup"); }); happy to add any additional information you may need or to answer any questions, just let me know(很乐意添加您可能需要的任何其他信息或回答任何问题,请告诉我)   ask by idontwantnoscrubs translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The problem you are having is to do with how JAWs intercepts key presses and uses a virtual cursor.(您遇到的问题与JAW如何截获按键并使用虚拟光标有关。)

When pressing left and right it is attempting to say the previous and next character and so it intercepts the key press, does the action and passes the left arrow key to the browser once as it is in 'document browsing mode'.(当按左右键时,它试图说出上一个和下一个字符,因此它会拦截按键,然后执行操作并将左箭头键一次传递给浏览器,就像在“文档浏览模式”中一样。) One way to stop this behaviour is to use role="application" and this signals screen readers to pass all information through to the browser normally.(阻止此行为的一种方法是使用role="application" ,这会通知屏幕阅读器正常将所有信息传递给浏览器。) Obviously you need to read all the documentation on role="application" as you could introduce accessibility issues rather than fix them if you aren't careful!(显然,您需要阅读关于role="application"所有文档,因为您可能会引入可访问性问题,而不是不小心就解决这些问题!) Relevant W3 Guidance(相关的W3指南) W3 Role - application information(W3角色-申请信息) When the user navigates an element assigned the role of application, assistive technologies that typically intercept standard keyboard events SHOULD switch to an application browsing mode, and pass keyboard events through to the web application.(当用户浏览分配了应用程序角色的元素时,通常拦截标准键盘事件的辅助技术应切换到应用程序浏览模式,并将键盘事件传递给Web应用程序。) The intent is to hint to certain assistive technologies to switch from normal browsing mode into a mode more appropriate for interacting with a web application;(目的是提示某些辅助技术从正常浏览模式切换到更适合与Web应用程序交互的模式。) some user agents have a browse navigation mode where keys, such as up and down arrows, are used to browse the document, and this native behavior prevents the use of these keys by a web application.(某些用户代理具有浏览导航模式,其中使用诸如向上和向下箭头之类的键来浏览文档,并且这种本机行为阻止Web应用程序使用这些键。)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...