Skip to content
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

accessibility: change hide_label to render the label in a div.sr-only #919

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ end
<div class="<%= 'required' if other_options[:required] %>">

<% # the label. %>
<% unless other_options[:hide_label] == true %>
<div class="<%= "sr-only" if other_options[:hide_label] == true %>">
<% if partial.label? %>
<%= partial.label %>
<% else %>
<% # allow the label to be defined via an inline option or else one of the locale yaml definitions. %>
<% label = (other_options[:label].presence || labels.label || legacy_label_for(form, method)) %>
<%= form.label method, label&.html_safe, class: 'block', for: options[:id] %>
<% end %>
<% end %>
</div>

<%# Here, we prioritize yielding the partial's field markup if it already exists. %>
<%# `form.send` below calls the original Rails Form helpers, such as %>
Expand Down