I have a search box in my html page. On enter key press - it filter out the data list to be shown below.
One of the screen reader requirement says that it should read out that No results are found when nothing matches.
As "no result found" is a non actionable element and ideally tab focus should not go that label. So how indicate that user of "No results found"
Not able to implement it using using aria-label aria-live
Sample Code : HTML :
<input tabindex="1" type="text" id="textIn" />
<div tabindex="1" id="searchContent" style="width:100px;height:50px;" aria-live="assertive">
</div>
Javascript
$("#textIn").on('keydown', function (e) {
if(e.keyCode == '13') {
shout();
}
})
function shout() {
var searchContent = $('#searchContent');
var noResults = document.createElement('div');
noResults.innerHTML = '<label class="">No Results found</label>';
searchContent.append(noResults);
}
tabindex
in two cases and incorrect used of<label>
, so I would like to see the full page to understand what else might be happening. – aardrian