最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - JavaScript keypress function and JAWS - Stack Overflow

programmeradmin1浏览0评论

I have a client that is required to be ADA-pliant. We found an issue when using IE9 and the JAWS screen reader. We have a jQuery function set up to scroll to another element on the page when the user Tabs down to a button and hits Enter. Here is the function:

jQuery('#ball_i5nqtjcVVB0CxYBJICklS6w').keypress(function(event) {
    if (event.keyCode == 13) {
        jQuery("#headofcurve").focus();
        scrollTo("form");
        liveballTag('Learn More');
    }
});

The problem is that when JAWS is running, hitting Enter doesn't do anything. I must hit Shift + Enter in order for it to scroll to the proper section and begin reading.

I have a client that is required to be ADA-pliant. We found an issue when using IE9 and the JAWS screen reader. We have a jQuery function set up to scroll to another element on the page when the user Tabs down to a button and hits Enter. Here is the function:

jQuery('#ball_i5nqtjcVVB0CxYBJICklS6w').keypress(function(event) {
    if (event.keyCode == 13) {
        jQuery("#headofcurve").focus();
        scrollTo("form");
        liveballTag('Learn More');
    }
});

The problem is that when JAWS is running, hitting Enter doesn't do anything. I must hit Shift + Enter in order for it to scroll to the proper section and begin reading.

Share Improve this question edited Jun 20, 2018 at 21:06 SOLO 8789 silver badges19 bronze badges asked Oct 29, 2014 at 19:30 notAGoodDevelopernotAGoodDeveloper 672 silver badges8 bronze badges 2
  • What element is it that you tab to and press enter? Is it a link or form control? If not, it might not work as expected without quite a bit of extra markup/script. – AlastairC Commented Oct 30, 2014 at 22:08
  • AlastairC it is a link. the button, when clicked on or when ENTER is hit should scroll the page down to the video section or form - depending on which button you select. jQuery is used for the scrollTo function. – notAGoodDeveloper Commented Nov 3, 2014 at 15:47
Add a ment  | 

1 Answer 1

Reset to default 6

This is normal behavior. It happens because of the way how JAWS (and most other moder screen readers, btw) handles webpages and other HTML-like content.
When a user opens up a webpage, he/she observes it with a so-called virtual cursor. That means that all keyboard mands change their meanings on webpages. This is done for the sake of quick navigation. For example, if you press h, you move to the next heading; if you press b, you move to the next button, and so on.
In order to type in something, you should be in forms mode. To enter the forms mode, you should press Enter on a form element such as an edit field or a bo box.
This said, you can't expect that Enter would be processed as you're used to do it without JAWS running.

You have two solutions here:

  1. Change the keystroke to scroll to your element from Enter to, say, Ctrl+Enter (I'd suggest choosing another one since Ctrl+Enter is used for sending messages in tons of messengers and other software alike).
  2. Assigning the application ARIA role to a part of your page. If JAWS encounters the application role, it passes all the keyboard mands through to the webpage itself. But be extremely careful with this mode since it's suggested by W3 Consortium not to overuse this role.
发布评论

评论列表(0)

  1. 暂无评论