Skip to content

Limit active disabled button styles to default button#6744

Merged
aduth merged 2 commits into
mainfrom
aduth-active-unstyled-btn
Aug 16, 2022
Merged

Limit active disabled button styles to default button#6744
aduth merged 2 commits into
mainfrom
aduth-active-unstyled-btn

Conversation

@aduth

@aduth aduth commented Aug 15, 2022

Copy link
Copy Markdown
Contributor

Fixes regression introduced in #6564

Why: Because the styling was only implemented with the expectation of use with the default button, and conflicts with other button states (e.g. unstyled buttons used as the submit buttons on some forms).

Screenshot:

State Before After
Default Screen Shot 2022-08-15 at 9 42 00 AM Screen Shot 2022-08-15 at 9 42 00 AM
Pressed Screen Shot 2022-08-15 at 9 38 32 AM Screen Shot 2022-08-15 at 9 42 20 AM

aduth added 2 commits August 15, 2022 09:43
**Why**: Because the styling was only implemented with the expectation of use with the default button, and conflicts with other button states (e.g. unstyled buttons used as the submit buttons on some forms).

Previously: #6564

changelog: Improvements, Forms, Use pressed state appearance for buttons disabled on form submission
Comment on lines -13 to -24

// Temporary: To be backported to design system. Unstyled buttons should not ever show the default
// opaque disabled background color. Typically a button would not be both disabled and active, but
// it is possible in some browsers when e.g. disabling a button in response to its own click.
&.usa-button:disabled:hover,
&.usa-button:disabled.usa-button--hover,
&.usa-button:disabled:active,
&.usa-button:disabled.usa-button--active,
&.usa-button:disabled:focus,
&.usa-button:disabled.usa-focus {
background-color: transparent;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was patched upstream in uswds/uswds#4077 , available as of USWDS 2.11.2 / identity-style-guide@6.0.0.

.usa-button:disabled.usa-button--active,
.usa-button--disabled.usa-button--active {
@include set-text-and-bg('primary-darker', $context: 'Button');
&:not(.usa-button--unstyled, .usa-button--secondary, .usa-button--accent-cool, .usa-button--accent-warm, .usa-button--base, .usa-button--outline, .usa-button--inverse) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally each of these button variants would just override the base like they do with the standard styles. Might be worth exploring that if / when backporting to the design system.

@zachmargolis zachmargolis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aduth aduth merged commit e52a20c into main Aug 16, 2022
@aduth aduth deleted the aduth-active-unstyled-btn branch August 16, 2022 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants