Fix label in related content form

It didn't have a `for` attribute and so it wasn't correctly associated
with its input. That means clicking on / touching the label didn't have
the effect of focusing on the field, and screen readers wouldn't
announce the label.
This commit is contained in:
Javi Martín
2021-06-22 21:53:22 +02:00
parent 85215e7e97
commit 49e0138cd1
2 changed files with 5 additions and 5 deletions

View File

@@ -3,7 +3,7 @@
</button>
<%= form_tag related_contents_path, method: :post, id: "related_content", "data-toggler": "unused-toggle-class" do %>
<label><%= t("related_content.label") %></label>
<label for="url"><%= t("related_content.label") %></label>
<p class="help-text" id="related_content_help_text">
<%= t("related_content.help", models: t("related_content.content_title").values.to_sentence, org: setting["org_name"]) %>

View File

@@ -36,7 +36,7 @@ shared_examples "relationable" do |relationable_model_name|
expect(page).to have_css ".add-related-content[aria-expanded='true']"
within("#related_content") do
fill_in "url", with: "#{url + related1.url}"
fill_in "Link to related content", with: "#{url + related1.url}"
click_button "Add"
end
@@ -53,7 +53,7 @@ shared_examples "relationable" do |relationable_model_name|
click_button "Add related content"
within("#related_content") do
fill_in "url", with: "#{url + related2.url}"
fill_in "Link to related content", with: "#{url + related2.url}"
click_button "Add"
end
@@ -69,7 +69,7 @@ shared_examples "relationable" do |relationable_model_name|
click_button "Add related content"
within("#related_content") do
fill_in "url", with: "http://invalidurl.com"
fill_in "Link to related content", with: "http://invalidurl.com"
click_button "Add"
end
@@ -83,7 +83,7 @@ shared_examples "relationable" do |relationable_model_name|
click_button "Add related content"
within("#related_content") do
fill_in "url", with: url + relationable.url.to_s
fill_in "Link to related content", with: url + relationable.url.to_s
click_button "Add"
end