Skip to content

Commit

Permalink
Add an aria-label to the "choose your booth" select
Browse files Browse the repository at this point in the history
We're using the `aria-label` attribute instead of a label because this
is a page where only one field is rendered and the text of the label is
the same as the text of the <h1> tag.

We're using `aria-label` instead of `aria-labelledby` because the former
is supported by Capybara.
  • Loading branch information
javierm committed Nov 12, 2024
1 parent 39d6205 commit 8130e4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/views/officing/booth/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<div class="small-12 column">
<%= f.select :id,
@booths.map { |booth| [booth.location, booth.id] },
selected: @booths.first,
label: false %>
{ selected: @booths.first, label: false },
{ "aria-label": t("officing.booth.new.title") } %>

<%= f.submit(t("devise_views.sessions.new.submit"), class: "button expanded") %>
</div>
Expand Down
4 changes: 2 additions & 2 deletions spec/system/officing/booth_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

expect(page).to have_content "Choose your booth"

select booth2.location, from: "booth_id"
select booth2.location, from: "Choose your booth"
click_button "Enter"

within("#officing-booth") do
Expand All @@ -72,6 +72,6 @@

expect(page).to have_content "Choose your booth"

expect(page).to have_select("booth_id", options: [booth1.location, booth2.location])
expect(page).to have_select "Choose your booth", options: [booth1.location, booth2.location]
end
end

0 comments on commit 8130e4f

Please sign in to comment.