Skip to content

Commit

Permalink
Add title attribute for better accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
HDinger committed Aug 29, 2024
1 parent d4b4a0f commit e974d00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/components/primer/open_project/feedback_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def initialize(**system_arguments)
)
@system_arguments[:id] ||= self.class.generate_id

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

delegate :header?, :header, :with_header, :with_header_content,
Expand Down
6 changes: 3 additions & 3 deletions previews/primer/open_project/feedback_dialog_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class FeedbackDialogPreview < ViewComponent::Preview
# @label Default
# @snapshot
def default
render(Primer::OpenProject::FeedbackDialog.new) do |dialog|
render(Primer::OpenProject::FeedbackDialog.new(title: "Success dialog")) do |dialog|
dialog.with_show_button { "Click me" }
dialog.with_feedback_message do |message|
message.with_heading(tag: :h2) { "Success" }
Expand Down Expand Up @@ -40,7 +40,7 @@ def additional_content

# @label With custom icon
def custom_icon
render(Primer::OpenProject::FeedbackDialog.new) do |dialog|
render(Primer::OpenProject::FeedbackDialog.new(title: "Error message")) do |dialog|
dialog.with_show_button { "Click me" }
dialog.with_feedback_message(icon_arguments: { icon: :"x-circle", color: :danger }) do |message|
message.with_heading(tag: :h2) { "Ups, something went wrong" }
Expand All @@ -56,7 +56,7 @@ def custom_footer

# @label With loading spinner
def loading_spinner
render(Primer::OpenProject::FeedbackDialog.new) do |dialog|
render(Primer::OpenProject::FeedbackDialog.new(title: "Waiting...")) do |dialog|
dialog.with_show_button { "Click me" }
dialog.with_feedback_message(loading: true) do |message|
message.with_heading(tag: :h2) { "Please wait, your request is being processed." }
Expand Down

0 comments on commit e974d00

Please sign in to comment.