-
Notifications
You must be signed in to change notification settings - Fork 17
Add accessible button element to dropdown arrow for screen reader support #68
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: JJJ <[email protected]>
Co-authored-by: JJJ <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds accessibility support for the dropdown arrow element by introducing a semantic <button> element inside the existing <b> tag wrapper. The button provides screen reader support with dynamic ARIA labels that toggle between "Show options" and "Hide options" based on dropdown state, while maintaining backwards compatibility with existing CSS selectors.
Key Changes
- Added accessible button element with ARIA labels inside the
<b>wrapper for screen reader support - Implemented dynamic aria-label updates in results_show() and results_hide() methods for both jQuery and Prototype versions
- Added CSS styling for transparent button overlay with visible keyboard focus outline
Reviewed changes
Copilot reviewed 7 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
coffee/lib/abstract-chosen.coffee |
Added button element with ARIA attributes to single select HTML template |
coffee/chosen.jquery.coffee |
Updated selector from .chosen-single div to .chosen-single-button for aria-label updates |
coffee/chosen.proto.coffee |
Updated Prototype template and selector for aria-label updates |
sass/chosen.scss |
Added .chosen-single-button styles with transparent overlay and focus outline |
docs/chosen.*.js |
Built JavaScript files reflecting CoffeeScript changes |
docs/chosen.css |
Compiled CSS with button styles |
docs/chosen.min.css |
Minified CSS output |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Summary
The dropdown arrow element (
<div><b></b></div>) was inaccessible to screen readers, causing accessibility scan warnings. Added a semantic<button>element with dynamic ARIA labels inside the existing<b>tag to provide keyboard accessibility and screen reader support while maintaining backwards compatibility with the ~6,800 repositories using.chosen-single div bCSS selectors.Changes:
<button type="button" class="chosen-single-button" aria-label="Show options" tabindex="-1">inside<b aria-hidden="true">wrapperresults_show()andresults_hide()to toggle button's aria-label between "Show options" and "Hide options" in both jQuery and Prototype versions.chosen-single-buttonstyles withopacity: 0for invisible but accessible overlay, visible focus outline on keyboard navigationBefore:
After:
The button is visually transparent but provides semantic meaning for assistive technologies. Existing
.chosen-single div bselectors continue to work for custom styling.Please double-check that:
package.json.References
Addresses accessibility concerns raised in the issue regarding empty
<div><b></b>elements triggering accessibility scan warnings.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
googlechromelabs.github.io/usr/local/bin/node node install.mjs(dns block)https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.204/linux64/chrome-headless-shell-linux64.zip/usr/local/bin/node node install.mjs(http block)https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1108766/chrome-linux.zip/usr/local/bin/node node install.js(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.