You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mark highlighted results with aria-selected (select2#5841)
* Switch CSS to use BEM over attribute selectors
Previously the CSS was using a combination of very specific BEM
class selectors and attribue selectors based off of ARIA attributes
that were expected to be present on the elements. This creates odd
specificity battles that people have been complaining about for
years, so now we're solving a few of the issues by switching to
BEM classes instead of using the mix.
This is a breaking change within any applications that override
the Select2 CSS through creating higher specificity selectors. While
the attributes are still present on the elements, we are no longer
going to be treating adjustements to them as breaking changes. This
is important becuase accessibility is a changing field and we know
we are going to have to make adjustments going forward.
* Mark highlighted results with aria-selected
This is a breaking change from past expectations where the options
within the results that were selected within the dataset were
previously marked as `aria-selected=true`.
When Select2 was first implementing the `aria-selected` attribute,
the interpretation that we followed was that the "selected" state
was supposed to represent the idea that the option was "selected"
similar to what is done within a standard dropdown. This would make
sense and would align with the interpretation of the WAI-ARIA
Authoring Practices 1.0 where it explicitly says that it represents
the selected state of the option. We later found out, after Select2
had been released, that this intepretation was incorrect and the
large majority of assistive technologies did not align with this
interpretation.
The `aria-selected` attribute should represent the location of
focus within the component. This allows screen readers to read the
contents out load and also detect changes within the focus location.
In later revisions of the WAI-ARIA spec, this was made more clear
that the `aria-selected` attribute forces the focus to be moved to
the element containing that attribute, which is in line with the
behaviour that was encountered during testing.
This should fix a bug that has been around for a while where using
VoiceOver in the Safari browser would result in the currently
focused option not being read aloud.
* Fix failing test
There was a test which was checking the selected status of an option
based on the `aria-selected` attribute. Instead this has been
switched over to check to make sure the new class is not present.
0 commit comments