Skip to content

Commit fea9ff4

Browse files
committed
Apply 'alertdialog' ARIA role to DangerDialog
Danger dialogs (both the confirmation and default, warning variant) clearly adhere to the alert dialog pattern: > The alertdialog role is to be used on modal alert dialogs that > interrupt a user's workflow to communicate an important message and > require a response. See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/alertdialog_role
1 parent 4ce9aa9 commit fea9ff4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/components/primer/open_project/danger_dialog.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,14 @@ def initialize(
8282
@confirm_button_text = confirm_button_text
8383
@cancel_button_text = cancel_button_text
8484

85-
@system_arguments = system_arguments
85+
@system_arguments = deny_tag_argument(**system_arguments)
86+
deny_single_argument(:role, "`role` will always be set to `alertdialog.", **@system_arguments)
8687
@system_arguments[:id] = @dialog_id
8788
@system_arguments[:classes] = class_names(
8889
system_arguments[:classes],
8990
"DangerDialog"
9091
)
92+
@system_arguments[:role] = "alertdialog"
9193

9294
@dialog = Primer::Alpha::Dialog.new(title: title, subtitle: nil, visually_hide_title: true, **@system_arguments)
9395
end

0 commit comments

Comments
 (0)