-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
One label is visible and the other is hidden. This makes testing difficult.

If you use the capybara check 'Approve' matcher, it fails saying "2 matching elements found". As a workaround you can use find('label', text: 'Approve', match: :first).click. It also seems not very accessible to have two labels for the same input.
The code does add label twice:
switch_group = template.content_tag(:div, class: "switch #{'switch--small' if options[:small]}") do
if include_hidden?
build_check_box(unchecked_value, merged_input_options)
else
build_check_box_without_hidden_field(merged_input_options)
end + label(wrapper_options)
end
if options[:label_after_input]
switch_group + label(wrapper_options)
else
label(wrapper_options) + switch_group
endBut if you remove the first one, the label is invisible. If you remove the other, the switch is invisible. So I can see how this issue arose, but there must be an accessible way to implement this.
Metadata
Metadata
Assignees
Labels
No labels