I have developed an accessibility feature for a dropdown component that dynamically populates values in the options menu only when the dropdown is opened. This means that it compiles the template on the fly and attaches it to the dropdown box.
Dropdown HTML:
<div id="dropdown" ng-click="openDropdown()">
<div id="selectedValue" role="listbox" tabindex="0" aria-label="{{selectedVal}}" aria-owns="dropDownMenu">{{selectedVal}}</div>
</div>
DropDown Menu template(which gets compiled and populated after clicking the dropdown above) :
<div id="dropDownMenu">
<li ng-click="selectItem()" role="option">item1</li>
<li ng-click="selectItem()" role="option">item2</li>
</div>
I am encountering two problems:
Since my #dropdownMenu is generated on click of #dropdown (dynamic template generation), JAWS does not have access to #dropdownMenu when focus comes to #selectedValue, therefore it doesn't announce the number of options etc as in the case of a typical select box.
I am using aria-label="{{selectedVal}}" for #selectedValue so that on arrow key clicks JavaScript updates selectedVal even though #dropdownMenu is not open. However, the changed value of selectedVal is not announced by JAWS 16.0, it only announces it the first time the user tabs into it. It should be noted that this works fine in JAWS 14.0.
I am looking forward to some solutions...