Use 1.18's aria role for dropdown menus (#24144) (#24155)

Backport #24144

Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
wxiaoguang 2023-04-17 19:02:09 +08:00 committed by GitHub
parent 463e144d97
commit 03b6e7900b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -34,8 +34,8 @@ function attachOneDropdownAria($dropdown) {
// Since #19861 we have prepared the "combobox" solution, but didn't get enough time to put it into practice and test before.
const isComboBox = $dropdown.find('input').length > 0;
const focusableRole = isComboBox ? 'combobox' : 'button';
const listPopupRole = isComboBox ? 'listbox' : 'menu';
const focusableRole = isComboBox ? 'combobox' : 'menu';
const listPopupRole = isComboBox ? 'listbox' : '';
const listItemRole = isComboBox ? 'option' : 'menuitem';
// make the item has role=option/menuitem, add an id if there wasn't one yet, make items as non-focusable