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/gorgeous-turtles-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/view-components": patch
---

Fix NVDA menu item counts that are broken by using '<form>' inside an 'ActionMenu'.
8 changes: 7 additions & 1 deletion app/components/primer/alpha/action_menu/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ def add_item(item, to:)
def organize_arguments(data: {}, **system_arguments)
content_arguments = system_arguments.delete(:content_arguments) || {}

# When a form is inside a menu, suppress form semantics.
# Otherwise, NVDA will miscount menu items.
form_arguments = system_arguments.delete(:form_arguments) || {}
form_arguments[:html] = form_arguments[:html] || {}
form_arguments[:html][:role] = :none

if system_arguments[:tag] && ITEM_TAG_OPTIONS.include?(system_arguments[:tag])
content_arguments[:tag] = system_arguments[:tag]
end
Expand All @@ -115,7 +121,7 @@ def organize_arguments(data: {}, **system_arguments)
)
end

{ data: data, **system_arguments, content_arguments: content_arguments }
{ data: data, **system_arguments, content_arguments: content_arguments, form_arguments: form_arguments }
end
end
end
Expand Down