Core JS Typeahead Bloodhound - results available read to screen reader

116 Views Asked by At

Wondering if anyone has this experience with typeahead.js and bloodhound (from this repo). When I get bloodhound suggestions from an AJAX request, the total number of results available are read to the screen reader (NVDA). When I get them from just a local JSON or JS object, they aren't read to the screen reader. The suggestions show up to a sighted user just fine, but the screen reader says "0 results are available".

I can't get NVDA to read either case in this jsfiddle but all the code is there. To complement the fiddle, I created a Github repo, where the error can be reproduced. Sorry it's probably way more code than is needed to troubleshoot the situation. Below is the snippet of the Bloodhound setup for the static data.

//Bloodhound for other / alt / fake data
var otherBH = new Bloodhound({
  name: "other",
  datumTokenizer: function (o) {
    var addr= Bloodhound.tokenizers.whitespace(o.addr);
    return addr;
  },
  queryTokenizer: Bloodhound.tokenizers.whitespace,
  identify: function(other) {return other.addr; },
  local: function() {
    var list = [];
    $.each(altdata,function(rec,val){
      list.push({addr: val.fakeaddr, source: "other"});
    });
    return list;
  }
})
otherBH.initialize();

0

There are 0 best solutions below