Add accessible button element to dropdown arrow for screen reader support#68
Draft
Add accessible button element to dropdown arrow for screen reader support#68
Conversation
Co-authored-by: JJJ <88951+JJJ@users.noreply.github.com>
Co-authored-by: JJJ <88951+JJJ@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix accessibility for chosen show/hide arrow element
Add accessible button element to dropdown arrow for screen reader support
Dec 10, 2025
There was a problem hiding this comment.
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 <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.