Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-12-01 22:36:10 +01:00

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

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. // 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 isComboBox = $dropdown.find('input').length > 0;
const focusableRole = isComboBox ? 'combobox' : 'button'; const focusableRole = isComboBox ? 'combobox' : 'menu';
const listPopupRole = isComboBox ? 'listbox' : 'menu'; const listPopupRole = isComboBox ? 'listbox' : '';
const listItemRole = isComboBox ? 'option' : 'menuitem'; 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 // make the item has role=option/menuitem, add an id if there wasn't one yet, make items as non-focusable