Skip to content

Make Collection Controls Aria Accessible#779

Merged
lcreid merged 11 commits intobootstrap-ruby:mainfrom
lcreid:763-collection-controls-not-aria-accessible
Dec 3, 2025
Merged

Make Collection Controls Aria Accessible#779
lcreid merged 11 commits intobootstrap-ruby:mainfrom
lcreid:763-collection-controls-not-aria-accessible

Conversation

@lcreid
Copy link
Copy Markdown
Contributor

@lcreid lcreid commented Nov 24, 2025

Make collection_checkboxes and collection_radio_buttons produce output that's more compliant with https://www.w3.org/WAI/tutorials/forms/grouping/#associating-related-controls-with-wai-aria.

Since the markup changes noticeably, this change is only enabled by setting the configuration option group_around_collections = true:

# config/initializers/bootstrap_form.rb

BootstrapForm.configure do |config|
  config.group_around_collections = true
end

This PR includes changes in the test files:

  • Moved the collection_checkboxes and collection_radio_button tests to their own files.
  • Test collection_checkboxes and collection_radio_button with the group_around_collections options both true and false.

Eventually, this behaviour should become the default, and later, the old behavour should disappear altogether.

Closes: #763.

@lcreid lcreid self-assigned this Nov 24, 2025
@lcreid lcreid merged commit 54094b7 into bootstrap-ruby:main Dec 3, 2025
18 checks passed
@lcreid lcreid deleted the 763-collection-controls-not-aria-accessible branch December 3, 2025 02:27
@johrstrom
Copy link
Copy Markdown
Contributor

Hi just want to comment here that I think this is a step in the right direction and to thank you for all the work. Labels for radio buttons are being read now and I believe they fit the WCAG guidelines, though I'm not an expert on the matter.

@pablobm
Copy link
Copy Markdown

pablobm commented Apr 14, 2026

Why was this made conditional on Rails.env.development?? I just arrived here while trying to figure out why my form worked differently in production and in development modes 😅

pablobm added a commit to pablobm/openstreetmap-website that referenced this pull request Apr 14, 2026
Issue introduced at
bootstrap-ruby/bootstrap_form#779.
No explanation at the time of committing.
pablobm added a commit to pablobm/openstreetmap-website that referenced this pull request Apr 14, 2026
In production, a new div was appearing showing a label that duplicated
the existing one. In development, this div exists but is empty and
therefore invisible.

This behaviour was introduced at
bootstrap-ruby/bootstrap_form#779. At the time
of this commit, there's no explanation as to the dev/prod difference.
What seems clear is that the prod behaviour is expected to be the
default in the future, so I went for it, enabling it explicitly. Then I
substituted the label I had added with the one that the form sets.
@lcreid
Copy link
Copy Markdown
Contributor Author

lcreid commented Apr 15, 2026

Why was this made conditional on Rails.env.development?? I just arrived here while trying to figure out why my form worked differently in production and in development modes 😅

First, thanks for your patience while I found some time to reply. I have no idea why I did this, and I normally hate it when I see software that behaves differently in production than it does in development. Let me dig some more and see if I had a reason. Otherwise, I'll fix it.

Thanks for catching this, and my sincere apologies for the confusion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

collection_radio_buttons not accessible

3 participants