fx140: a11y fix voiceover not reading out menulist labels (#5540)

Post-fx140, menulist labels in chrome windows are not
announced by VoiceOver. Setting the menulist's role to 'combobox'
addresses this and gets VoiceOver to announce the labels again.
This is interesting because 'combobox' is supposedly
menulist's implicit role, so it's not clear why this helps.

It does slightly change the way VoiceOver announces
menulists: it announces "combobox" instead of "popup button",
but semantically combobox is still appropriate per
https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only

Fixes: #5424
This commit is contained in:
abaevbog 2025-09-12 23:57:51 -05:00 • committed by GitHub
parent e896fd0137
commit 562fed6e7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -241,6 +241,13 @@ Services.scriptloader.loadSubScript('chrome://zotero/content/elements/itemTreeMe
this.removeAttribute("aria-hidden");
});
});
// Fx140: set the menulist role to 'combobox' to fix VoiceOver no longer announcing
// menulist's label. combobox is already menulist's implicit role, so it's not clear why this helps.
// Handle this here instead of connectedCallback of menulist because that doesn't get called
// if menulist exists in the initial .xhtml (vs inserted dynamically)
if (this.parentElement && this.parentElement.localName == 'menulist') {
this.parentElement.setAttribute("role", "combobox");
}
// This event is triggered after clicking the menu and before popuphiding
// where we control whether the fade out animation should run