Add an ARIA label to site customization images fields

This way it'll be easier for people using screen readers to know which
field they're on.
This commit is contained in:
Javi Martín
2024-10-10 23:47:32 +02:00
parent 331228cb2a
commit 5ca65a787f
2 changed files with 7 additions and 7 deletions

View File

@@ -2,7 +2,7 @@
<%= form_for([:admin, image], html: { id: "edit_#{dom_id(image)}" }) do |f| %> <%= form_for([:admin, image], html: { id: "edit_#{dom_id(image)}" }) do |f| %>
<div> <div>
<%= image_tag image.image if image.persisted_attachment? %> <%= image_tag image.image if image.persisted_attachment? %>
<%= f.file_field :image, label: false %> <%= f.file_field :image, label: false, "aria-label": image.name %>
</div> </div>
<%= f.submit(t("admin.site_customization.images.index.update"), class: "button hollow") %> <%= f.submit(t("admin.site_customization.images.index.update"), class: "button hollow") %>

View File

@@ -10,7 +10,7 @@ describe "Admin custom images", :admin do
end end
within("tr#image_logo_header") do within("tr#image_logo_header") do
attach_file "site_customization_image_image", file_fixture("logo_header.png") attach_file "logo_header", file_fixture("logo_header.png")
click_button "Update" click_button "Update"
end end
@@ -22,7 +22,7 @@ describe "Admin custom images", :admin do
visit admin_site_customization_images_path visit admin_site_customization_images_path
within("tr#image_map") do within("tr#image_map") do
attach_file "site_customization_image_image", file_fixture("custom_map.jpg") attach_file "map", file_fixture("custom_map.jpg")
click_button "Update" click_button "Update"
end end
@@ -38,7 +38,7 @@ describe "Admin custom images", :admin do
visit admin_site_customization_images_path visit admin_site_customization_images_path
within("tr#image_map") do within("tr#image_map") do
attach_file "site_customization_image_image", file_fixture("custom_map.jpg") attach_file "map", file_fixture("custom_map.jpg")
click_button "Update" click_button "Update"
end end
@@ -78,7 +78,7 @@ describe "Admin custom images", :admin do
visit admin_site_customization_images_path visit admin_site_customization_images_path
within("tr#image_logo_email") do within("tr#image_logo_email") do
attach_file "site_customization_image_image", file_fixture("logo_email_custom.png") attach_file "logo_email", file_fixture("logo_email_custom.png")
click_button "Update" click_button "Update"
end end
@@ -93,7 +93,7 @@ describe "Admin custom images", :admin do
visit admin_site_customization_images_path visit admin_site_customization_images_path
within("tr#image_social_media_icon") do within("tr#image_social_media_icon") do
attach_file "site_customization_image_image", file_fixture("logo_header.png") attach_file "social_media_icon", file_fixture("logo_header.png")
click_button "Update" click_button "Update"
end end
@@ -105,7 +105,7 @@ describe "Admin custom images", :admin do
visit admin_site_customization_images_path visit admin_site_customization_images_path
within("tr#image_social_media_icon") do within("tr#image_social_media_icon") do
attach_file "site_customization_image_image", file_fixture("social_media_icon.png") attach_file "social_media_icon", file_fixture("social_media_icon.png")
click_button "Update" click_button "Update"
end end