Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/hip-flies-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/view-components": patch
---

Give inputs unique ids so that SR doesn't skip Label announcement
4 changes: 3 additions & 1 deletion app/lib/primer/forms/dsl/multi_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def decorate_options(name:, **options)
new_options[:data] ||= {}
new_options[:data][:name] = name
new_options[:data][:targets] = "primer-multi-input.fields"
new_options[:id] = nil if options[:hidden]
new_options[:id] = "#{@name}_#{name}"
new_options[:aria] ||= {}
new_options[:aria][:labelledby] = "label-#{base_id}"
new_options[:disabled] = true if options[:hidden] # disable to avoid submitting to server
Comment thread
llastflowers marked this conversation as resolved.
new_options
end
Expand Down
3 changes: 2 additions & 1 deletion app/lib/primer/forms/form_control.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<% if @input.form_control? %>
<%= content_tag(@tag, **@form_group_arguments) do %>
<% if @input.label %>
<%= builder.label(@input.name, **@input.label_arguments) do %>
<% label_id = @input.label_arguments[:id] || "label-#{@input.base_id}" %>
<%= builder.label(@input.name, **@input.label_arguments.merge(id: label_id)) do %>
<%= @input.label %>
<% if @input.required? %>
<span aria-hidden="true">*</span>
Expand Down
12 changes: 9 additions & 3 deletions lib/primer/accessibility.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ module Accessibility
per_component: {
Primer::Alpha::ToggleSwitch => {
all_scenarios: %i[button-name]
},

Primer::Alpha::MultiInput => {
visually_hide_label: %i[label-title-only]
}
Comment thread
llastflowers marked this conversation as resolved.
}
}
Expand All @@ -46,6 +50,8 @@ def ignore_preview?(preview_class)
end

def axe_rules_to_skip(component: nil, scenario_name: nil, flatten: false)
scenario_key = scenario_name.is_a?(String) ? scenario_name.to_sym : scenario_name

to_skip = {
wont_fix: Set.new(AXE_RULES_TO_SKIP.dig(:wont_fix, :global) || []),
will_fix: Set.new(AXE_RULES_TO_SKIP.dig(:will_fix, :global) || [])
Expand All @@ -55,9 +61,9 @@ def axe_rules_to_skip(component: nil, scenario_name: nil, flatten: false)
to_skip[:wont_fix].merge(AXE_RULES_TO_SKIP.dig(:wont_fix, :per_component, component, :all_scenarios) || [])
to_skip[:will_fix].merge(AXE_RULES_TO_SKIP.dig(:will_fix, :per_component, component, :all_scenarios) || [])

if scenario_name
to_skip[:wont_fix].merge(AXE_RULES_TO_SKIP.dig(:wont_fix, :per_component, component, scenario_name) || [])
to_skip[:will_fix].merge(AXE_RULES_TO_SKIP.dig(:will_fix, :per_component, component, scenario_name) || [])
if scenario_key
to_skip[:wont_fix].merge(AXE_RULES_TO_SKIP.dig(:wont_fix, :per_component, component, scenario_key) || [])
to_skip[:will_fix].merge(AXE_RULES_TO_SKIP.dig(:will_fix, :per_component, component, scenario_key) || [])
end
end

Expand Down
3 changes: 2 additions & 1 deletion static/info_arch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5312,7 +5312,8 @@
"snapshot": "true",
"skip_rules": {
"wont_fix": [
"region"
"region",
"label-title-only"
],
"will_fix": [
"color-contrast"
Expand Down
3 changes: 2 additions & 1 deletion static/previews.json
Original file line number Diff line number Diff line change
Expand Up @@ -4883,7 +4883,8 @@
"snapshot": "true",
"skip_rules": {
"wont_fix": [
"region"
"region",
"label-title-only"
],
"will_fix": [
"color-contrast"
Expand Down
Loading