Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are you trying to accomplish?
This PR updates all of our buttons (via the
BaseButton
component) to support being disabled. This is done by forcing the tag to<button>
ifdisabled: true
is specified.Screenshots
Screenshots are not necessary in this case because all buttons still appear visually disabled with this change.
Integration
I wrote up a fake ERB linter and Ruby code scanner to identify cases where the
disabled:
option is passed toBeta::Button
,Alpha::ButtonMarketing
,Alpha::HellipButton
,Beta::IconButton
,Beta::CloseButton
,Beta::BaseButton
, andButtonComponent
, that also specify a tag other than<button>
.The scripts linked above only identified a few usages that fit the criteria:
<a>
tags cannot be disabled. That said, we should take the opportunity to clean this up by settingtag: :a
.<button>
.<details>
tag.tag: :summary
argument.List the issues that this change affects.
Fixes https://github.com/github/primer/issues/2222
Risk Assessment
What approach did you choose and why?
Currently a number of our buttons that allow tag customization can't be disabled if a tag other than
<button>
is used. This is because the other two types of allowed tag,<a>
and<summary>
, cannot be disabled by setting thedisabled
HTML attribute as can be done for<button>
s. In theActionMenu
component, we solved this by forcing the tag to<button>
ifdisabled: true
is specified. This PR does the same for all users ofBaseButton
.Anything you want to highlight for special attention from reviewers?
This change could cause problems with code that assumes a particular tag will be used for any given button. I feel as though I did my due diligence tracking down usages though, so we should be good to go.
Accessibility
This change doesn't fix an Axe violation (that I know of), but it does make our buttons more accessible overall.
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.