1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00

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

According to erion's feedback, the 1.18 approach works with Safari
(`role=menu` on the parent container), while the 1.19's approach doesn't
work well with Safari+VoiceOver (although I tested it worked with Chrome
a little better).

I have tested this 1.18 approach could work for all
Safari/Chrome+VoiceOver and Chrome+Talkback.

Let's try to make it on try.gitea.io to see whether it helps Safari
users.
This commit is contained in:
wxiaoguang 2023-04-16 21:58:22 +08:00 committed by GitHub
parent 0e05984667
commit 685b0ffa19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -148,8 +148,8 @@ function attachInit($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;
dropdown[ariaPatchKey].focusableRole = isComboBox ? 'combobox' : 'button'; dropdown[ariaPatchKey].focusableRole = isComboBox ? 'combobox' : 'menu';
dropdown[ariaPatchKey].listPopupRole = isComboBox ? 'listbox' : 'menu'; dropdown[ariaPatchKey].listPopupRole = isComboBox ? 'listbox' : '';
dropdown[ariaPatchKey].listItemRole = isComboBox ? 'option' : 'menuitem'; dropdown[ariaPatchKey].listItemRole = isComboBox ? 'option' : 'menuitem';
attachDomEvents($dropdown, $focusable, $menu); attachDomEvents($dropdown, $focusable, $menu);