-
Notifications
You must be signed in to change notification settings - Fork 125
Add Dialog::Header
close_scheme
, close_label
params
#3373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Leaving this in draft - @HDinger, could you have a look? |
ce0f31e
to
10e6096
Compare
Allows the customization of the close button - or removal entirely.
10e6096
to
e6cf575
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, I'd vote for splitting this PR into two: One for changing the label which is pretty straightforward imho. The other one for making the close button optional which is probably more controversial.
@@ -16,6 +16,14 @@ class Header < Primer::Component | |||
}.freeze | |||
VARIANT_OPTIONS = VARIANT_MAPPINGS.keys | |||
|
|||
DEFAULT_CLOSE_SCHEME = :close | |||
CLOSE_SCHEMES = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Schemes are usually something like :danger
, :primary
and so on.. Since you want to achieve a boolean flag to hide and show the close button, it maybe makes sense to make that a boolean like show_close_button
.
Hi! This pull request has been marked as stale because it has been open with no activity for 60 days. You can comment on the pull request or remove the stale label to keep it open. If you do nothing, this pull request will be closed in 7 days. |
What are you trying to accomplish?
Currently it is not possible to specify a custom ARIA label for the Dialog close button. This is problematic for apps (like OpenProject) with fully localized UIs.
This PR adds two new params to
Primer::Alpha::Dialog::Header#initialize
:@param close_scheme [Symbol]
Whether the component can be closed with an "x" button. Either:close
or:none
.@param close_label [String]
Thearia-label
text of the close "x" button.This allows for a few new scenarios:
close_label:
argument (e.g. withI18n.t
).Screenshots
custom close label:
without a header close button:
the initial focussed element is the footer close button.
Integration
This should not be a breaking change.
List the issues that this change affects.
Closes # (type the GitHub issue number after #)
Related OpenProject Work Package: https://community.openproject.org/wp/61631
Risk Assessment
What approach did you choose and why?
This API is modelled on the
Primer::Alpha::Banner
component, which acceptsdismiss_scheme
anddismiss_label
arguments.My initial approach was to create a
close_button
slot - I went ahead and pushed that work (see #3374) but wasn't happy with the API. For example, in order the hide the close button, you would need to callwith_close_button
without a block.Anything you want to highlight for special attention from reviewers?
Accessibility
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.