This comment has been minimized.

Well, the semantics of this input field is completely overridden by the applied ARIA role. Technologies that understand ARIA will get it is a "combobox" (also, currently has a role="textbox") so the type attribute is not so much relevant.
About browsers, the only difference with a text box I'm aware of is webkit special styling which Select2 resets with CSS

Well, the semantics of this input field is completely overridden by the applied ARIA role. Technologies that understand ARIA will get it is a "combobox" (also, currently has a role="textbox") so the type attribute is not so much relevant.
About browsers, the only difference with a text box I'm aware of is webkit special styling which Select2 resets with CSS

I'm afraid ARIA doesn't provide a way to emulate the semantics of optgroup or at least I wasn't able to find it. Nested groups would require further investigation and iteration. That's why I'm proposing to proceed with small steps and then iterate, if you agree :)

Testing the PR, only Firefox+NVDA announce the group "labels", IE11+JAWS skip the labels but do announce the options, Safari+VoiceOver announce just the "flat" ones.

I'm afraid ARIA doesn't provide a way to emulate the semantics of optgroup or at least I wasn't able to find it. Nested groups would require further investigation and iteration. That's why I'm proposing to proceed with small steps and then iterate, if you agree :)

Testing the PR, only Firefox+NVDA announce the group "labels", IE11+JAWS skip the labels but do announce the options, Safari+VoiceOver announce just the "flat" ones.

This comment has been minimized.

I want to thank Paal Joachim Romdahl for reminding me about this pull request, not because I forgot about it (I've been discussing this with a few others for a while now), but because I never publicly commented about the plans for Select2 to handle this.

As has been mentioned a couple of times before, Select2 supports a wide variety of use cases, some of which are natively supported by screen readers and others not so much. Our goal with Select2 4.0.0 was to make Select2 natively accessible and to do it right the first time, so we didn't have to hack it in later. Part of that involved researching existing implementations, looking into any recent improvements to ARIA, and doing some testing of our own along the way. As we've clearly learned after the release of Select2 4.0.0, we didn't get it right the first time, we actually got it very wrong. We accept that, and hopefully we can get Select2 to a state where it is at least partially acceptable, so the most basic use cases work natively. From there, we hope to work to get the more advanced use cases supported.

In the next couple of weeks, we plan to work with others to get Select2 to be accessible under the most basic use case: a flat dropdown that is searchable. Since that appears to be the use case that most screen readers support.

I want to thank Paal Joachim Romdahl for reminding me about this pull request, not because I forgot about it (I've been discussing this with a few others for a while now), but because I never publicly commented about the plans for Select2 to handle this.

As has been mentioned a couple of times before, Select2 supports a wide variety of use cases, some of which are natively supported by screen readers and others not so much. Our goal with Select2 4.0.0 was to make Select2 natively accessible and to do it right the first time, so we didn't have to hack it in later. Part of that involved researching existing implementations, looking into any recent improvements to ARIA, and doing some testing of our own along the way. As we've clearly learned after the release of Select2 4.0.0, we didn't get it right the first time, we actually got it very wrong. We accept that, and hopefully we can get Select2 to a state where it is at least partially acceptable, so the most basic use cases work natively. From there, we hope to work to get the more advanced use cases supported.

In the next couple of weeks, we plan to work with others to get Select2 to be accessible under the most basic use case: a flat dropdown that is searchable. Since that appears to be the use case that most screen readers support.