3
votes

I have a search form. When user submits form, ajax request is sent to the server. When the response comes, I update found items count value, but JAWS reads previous items count value. To get JAWS read new content I use aria attributes and role="status". But JAWS still doesn't work as expected.

What I've tried: Getting screen reader to read new content added with JavaScript, aria-live and JAWS, ARIA Live Regions and etc.

What am I doing wrong?

HTML

<form class="search-form">
     <label class="keyword-search-input-label" for="keyword-search-input">
          <span class="hide">Search</span>
          <input class="form-control" type="text" id="keyword-search-input" name="keyword"/>
     </label>

     <button id="clear-field-button" type="reset">
          <span class="hide">Clear Search Field</span>
     </button>
     <button id="search-button" type="submit" aria-describedby="number-found-items">
          <span class="symbol-label">Search</span>
     </button>
</form>
<div id="number-found-items" role="status" aria-live="assertive" aria-atomic="true" aria-relevant="all">
      <span id="number-found">0</span>
      items found
</div>

JS

function updateNumberFound(value) {
    $numberFound.text(value || 0);
}

jsFiddle To reproduce the problem try to focus on search input, type some text and press search button, while JAWS is on.

1
can you set up a jsfiddle to reproduce the problem? - unobf
@unobf, I've added jsfiddle. Can you please check it? - iOne

1 Answers

1
votes

The correct way to do this is to use a role="log" region that is inserted into the document when it loads and is off screen. Then to append the text that you want announced to that region when updates occur.

I have modified your fiddle to include the a11yfy library's code which does this: https://jsfiddle.net/17mkL2n5/1/embedded/result/

jQuery.a11yfy.assertiveAnnounce(value + ' items found');

I have tested this on OS X with VO, Windows with NVDA and Windows IE 11 with JAWS 14 and they all work correctly.