New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature proposal: Copy aria-label attribute to select 2 input field #4930
Comments
+1 When checking for WCAG compliance, I noticed that all of those inputs lack a label. I have not yet found a decent workaround for this. I'd also like to see the Example<div class="form-group">
<label for="my_select" id="my_select_label">My label</label>
<select id="my_select" aria-labelledby="my_select_label">...</select>
<!-- copy the aria-labelledby -->
<input class="select2-search_field" aria-labelledby="my_select_label">
</div> As a really gross hack, I ended up doing this: $(".select2-search__field").attr("aria-label", function(){
return $(this).closest(".form-group").children("label").text()
}) Aside: I don't really understand the point of |
Hi @dagoss ,
I have added label in parent Thanks and appreciate your efforts. |
@Sachin4dotnet It probably didn't work for you because my jquery selector was looking for a container |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Reopening this since I think it's a valid accessibility request for Select2. |
Hi is there a way to set attributes tabindex & aria-hidden on a multiple select, to improved accessibility?
to have
As @dagoss mentioned above
|
+1 for this issue, it is very important under new accessibility laws for European Union, possibly California and others. |
I'm pretty sure the select2/src/js/select2/selection/base.js Lines 24 to 31 in cd545a4
Because browsers suck at consistency so we need to allow screen readers to be able to focus on the original This feature request remains open, likely expanding the scope to reasonable ARIA attributes and not just the original |
Has this issue been addressed yet? |
I was able to tackle this using the Adapters. Had to write my own "ariaLabelledbyAdapter" and then override the |
Currently if you set an aria-label attribute on your select menu for a multiple select, the aria-label is not copied to the select2 input field. It would be useful if this could be copied for improved accessibility.
The text was updated successfully, but these errors were encountered: