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

Chrome error: label's for attribute doesn't match any element id #1816

Open
MtnBiker opened this issue Jun 26, 2023 · 0 comments
Open

Chrome error: label's for attribute doesn't match any element id #1816

MtnBiker opened this issue Jun 26, 2023 · 0 comments

Comments

@MtnBiker
Copy link

MtnBiker commented Jun 26, 2023

Error reported by Chrome

"The label's for attribute doesn't match any element id. This might prevent the browser from correctly autofilling the form and accessibility tools from working correctly"

Everything seems to be working OK. But noted while trying to debug something else.

Environment

  • Ruby v3.2
  • Rails 7.1
  • simple_form (5.2.0)
  • gem "jsbundling-rails"

html.erb

<%= simple_form_for @year do |form| %> 
  <%= form.label :year_date, "Date:", class:"fw-bold" %>
  <%= form.input :year_date, start_year: 1874, end_year: 1950, label: false %>

Results in

<label class="fw-bold" for="year_year_date">Date:</label>
    <div class="input date optional year_year_date field_without_errors"><select id="year_year_date_1i" name="year[year_date(1i)]" class="date optional">
<option value="1874">1874</option>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant