Skip to content

Commit

Permalink
[Alpha][SelectPanel] Add aria-labelledby on the dialog in the SelectP…
Browse files Browse the repository at this point in the history
…anel (#2994)
  • Loading branch information
kendallgassner authored Aug 6, 2024
1 parent 332601e commit 3bf8fd4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tasty-icons-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/view-components': patch
---

Add aria-labelledby on the SelectPanel dialog
1 change: 1 addition & 0 deletions app/components/primer/alpha/select_panel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ def initialize(

@dialog = Primer::BaseComponent.new(
id: "#{@panel_id}-dialog",
"aria-labelledby": "#{@panel_id}-dialog-title",
tag: :dialog,
data: { target: "select-panel.dialog" },
classes: class_names(
Expand Down
8 changes: 8 additions & 0 deletions test/components/alpha/select_panel_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ def test_list_role
assert_selector "select-panel action-list ul[id='#{panel_id}-list'][role=listbox]"
end

def test_aria_labelledby_dialog
render_preview(:default)

dialog_labelledby_id = page.find_css("dialog").first.attributes["aria-labelledby"].value
header_id = page.find_css("select-panel h1").first.attributes["id"].value
assert_equal dialog_labelledby_id, header_id
end

def test_renders_close_button
render_preview(:default)

Expand Down

0 comments on commit 3bf8fd4

Please sign in to comment.