Since you posted some sources, it might be appropriate to warn you of some pretty important shortcomings of the example code in link 2:
aria-expanded
needs to be used on the controlling element, i.e. the <input role="combobox">
, and not on the listbox
It’s also weird that aria-autocomplete="list"
is set, while the input is readonly
, and therefore cannot provide any auto completion.
So here is a corrected version:
<label>Combobox<input type="text" aria-activedescendant="cb1-opt6" aria-readonly="true" aria-owns="cb1-list" aria-autocomplete="list" role="combobox" id="cb1-edit" value="California"></label><ul role="listbox" id="cb1-list"><li role="option" id="cb1-opt1">Alabama</li><li role="option" id="cb1-opt2">Alaska</li><li role="option" id="cb1-opt3">American Samoa</li><li role="option" id="cb1-opt4">Arizona</li><li role="option" id="cb1-opt5">Arkansas</li><li role="option" id="cb1-opt6" class="active">California</li><li role="option" id="cb1-opt7">Colorado</li></ul>