-
Notifications
You must be signed in to change notification settings - Fork 548
Select element's default role of "listbox" is odd #1013
Comments
I had a form with a select that was dynamically assigned an aria-describedby (for form validation). While using VoiceOver on macOS Sierra, the select was read back as a menu item, and the associated content that contained the error would not be read by VoiceOver. Once I added a role of listbox to the select, VoiceOver read back the associated content. VoiceOver on an iPhone running OS 10 does not behave this way. It feels strange to assign a role to a select dropdown - it is semantically correct, but VO ignores all aria-labelledby and aria-describedby tags unless you add a role of listbox or combobox to it. |
Ping @joanmarie, @jasonkiss, @stevefaulkner |
Yeah, I'll plus one this +1. It seems to be quite a strange change by making I get that a Just seems that instructing AT vendors to change its identification of default |
I agree with the general sentiment of this thread that we need to resolve some issues with consistency across platforms. However, as a screen reader user who has for decades been frustrated by the vagueries caused by the inconsistent use of terms, I disagree with the technical solution proposed here. In fact, I propose just the opposite mapping in w3c/html-aam#46. Keep in mind that the most important thing the ARIA role does is communicate an interaction pattern. And, the most important recipient of that information is the assistive technology. It is then the responsibility of the assistive technology to make the cryptic role identifier with its associated states and properties understandable to the user. The purpose of the ARIA mappings is not to describe visual styling or presentation. That said, it is helpful to certain categories of users if the styling used on an element does not directly conflict with the general sense of the type of element communicated by the role. HTML So, fixing the HTML mapping of select so it is always listbox, regardless of presentation, will at least stop screen readers from calling elements that do not have combobox features from being called comboboxes. And, if we add aria-expanded to listbox, we could even accurately represent the difference between BTW, at least in ARIA, which is what we are mapping to HTML, a combobox is defined as the combination of a textbox and an associated popup. HTML selects do not have any textbox functionality. The other way of making a single select is what you often see on Mac; it is a button whose label changes depending on the selected value. These elements are perfectly described by the ARIA menu button pattern. In this case, you have a button with aria-haspopup set to "menu", which is the same as "true" in ARIA 1.0. Then, the button opens a menu that contains either menuitemcheckbox elements or menuitemradio elements. The item the user chooses becomes the selected value, which also labels the button after the item is activated and the menu closes. The most confusing issue, though, and one legacy effect that I am dieing to make history is the screen reader announcement of elements that Carolyn is talking about ... I almost hesitate to say the words ... readonly combobox. Fortunately, controls like this are few and far between. What do you think most screen reader users think when they hear "read only"? They think the control is read only, meaning you cannot change its value. Since an HTML select is significantly different from this kind of control, I think the solution to this is unrelated to this issue. I am hoping to someday soon gather the right people around a table and figure out a good way of tackling that one. In the meantime, it is easy to build one by simply implementing the ARIA combobox pattern and adding aria-readonly="true" to the textbox element. Finally, as much of this is addressed in the combobox design pattern I have just finished drafting for the ARIA Authoring Practices, please read that and provide feedback. |
Sure, I get it. On paper, technically speaking the dreaded "readonly combobox" feels and interacts in a way that is essentially identical to a listbox. I don't feel that means we get to discount it as being a thing, though. For example, you write:
I can't disagree more. Folks hate the way a So that leads me to the question of how would you implement something like that if we pretend a readonly combobox, That kind of leaves a listbox, but again, I've sat down with a colleague and we can't for the life of us think of a way to manipulate a listbox to look like a Suggestions? I'm all ears. Another thing I'd like to raise if we're going to diverge from calling I'm sure there's some guideline by the W3C (wish I could find it again) somewhere that essentially says "user experience over technical detail", and I feel we're leaning heavily to technically correct answers here. |
@SiTaggart commented
User experience is my number one concern. It is the focus of nearly all my work inside and outside of W3C. With the way we designed ARIA 1.x, which is admitteddly more practical than ideal, our ability to design and build great user experiences for people relying on assistive technologies depends on ARIA roles reliably representing interaction models.
Ya, agree. I meant the implementations of select-like thingies that actually include a textbox that is announced as read-only by a screen reader are few and far between. There are pockets of space where they are very common because of a specific toolkit, but the vast majority behave more like an HTML select when accessed with one of the popular screen readers.
There are several good ways. It's worth saying first, though, that it is important that we not let ARIA and accessibility unnecessarily box designers and engineers. That said, there is no perfect way with today's ARIA to create the flavor of this kind of element that includes a read-only text field with a caret that can be used for selecting text and possibly deleting the value of the field. We can make that flavor, but it will have the severe downside of being announced as a "read-only combobox" or something similar.
I don't agree that such an implementation is inappropriate or misleads Windows users.
The menu button pattern can perfectly communicate the interaction model for select widgets regardless of platform.
While the listbox pattern lacks one of the beneficial escape key behaviors that the menu button affords, it is an equally viable approach. I wonder what is tripping you up. Simply build the component you describe and then give it the listbox role. As long as your component has the interaction model, roles, states, and properties that are associated with the listbox pattern, it is a listbox. Basically, make it work exactly like HTML Then, you need only two enhancements to the typical listbox pattern as currently described in the ARIA Authoring Practices. First, add a non-focusable, interactive icon next to the listbox that serves as your clickable expansion element. Then, whenever the list is expanded to show more than the current value, set aria-expanded to true; have it be false otherwise. I guess we should build this for the ARIA Authoring Practices. The current listbox pattern is at:
I agree that we want ARIA to help people use GUIs on the web by making them feel native. I would not recommend styling a web component like a select or native combobox and then calling it a menu button. If you are going to use the menu button pattern, it should most definitely look like a button that opens a menu. On the other hand, if you are going to style like some kind of field with a dropdown list, those type of things in native Windows are not all comboboxes. They very well could be a listbox or an edit with a popup or some type of split button. What is more important than appearance is that the assistive technology knows how to help the euser operate the thing. But, if you want to go there, I would love to see more consistency on Windows and maybe someday have agreement that native Windows Comboboxes are components that include both an edit field and a popup. What is more likely, though, is that ARIA 2.0 will support some type of control pattern model so that assistive technologies need not depend so heavily on element roles. |
refer to w3c/html#1013 /cc @sideshowbarker = changes to conformance requirements
|
HTML spec update 8ec3037 fixes this |
Change-Id: Iae0c4177629708745185e3b8912c3ff7d4a6a006 Signed-off-by: carmacleod <[email protected]> [Thank you Carolyn]
I am caught by this issue, and I totally agree with @mcking65 . It's confusing for web front-end programmers to understand why html select element is mapping to combobox. And "readonly combobox" is a very bad term. Most will expect the whole widget is readonly but it seems in the context of this issue it means the textbox of the combobox is readonly but the listbox of the combobox is not readonly. This is very confusing. |
The default role for the select element in the spec is "listbox". This has an odd feel to it, because it behaves a lot more like a "read-only combobox" from desktop days.
The ARIA in HTML spec says the same as the HTML spec:
The Accessibility API Mappings document recommends either
listbox
orcombobox
for select:https://w3c.github.io/html-aam/#el-select-listbox
http://w3c.github.io/aria/core-aam/core-aam.html#role-map-listbox
https://w3c.github.io/html-aam/#el-select-combobox
http://w3c.github.io/aria/core-aam/core-aam.html#role-map-combobox
So a plain-old select (with no multiple or size > 1 attributes) really should have a default role of "combobox".
An additional inconsistency is that Mac calls it a "popup menu".
There seems to be some "fuzziness" around what select should map to, and what a "read-only combobox" should be, as noted in this ARIA Authoring Practices Guide issue.
Would be nice to have consistency across all the specs/docs. Starting with the HTML spec, I think that it should say the following (precedent for the sentence format is in some of the input element specs, i.e. type=search, tel, url):
The text was updated successfully, but these errors were encountered: