diff --git a/.changeset/healthy-dots-chew.md b/.changeset/healthy-dots-chew.md new file mode 100644 index 00000000000..65e4bdcc842 --- /dev/null +++ b/.changeset/healthy-dots-chew.md @@ -0,0 +1,6 @@ +--- +"@primer/react": patch +--- + +- Update styles for default variant of Button's active state +- Use active state for Button when it is used to open an Overlay diff --git a/src/Button/styles.ts b/src/Button/styles.ts index 25143ec6763..b8b34ea6789 100644 --- a/src/Button/styles.ts +++ b/src/Button/styles.ts @@ -17,12 +17,16 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme boxShadow: `${theme?.shadows.btn.focusShadow}` }, '&:active:not([disabled])': { - backgroundColor: 'btn.selectedBg', - boxShadow: `${theme?.shadows.btn.shadowActive}` + backgroundColor: 'btn.activeBg', + borderColor: 'btn.activeBorder' }, '&:disabled': { color: 'primer.fg.disabled', backgroundColor: 'btn.disabledBg' + }, + '&[aria-expanded=true]': { + backgroundColor: 'btn.activeBg', + borderColor: 'btn.activeBorder' } }, primary: { @@ -49,6 +53,10 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme '[data-component="ButtonCounter"]': { backgroundColor: 'btn.primary.counterBg', color: 'btn.primary.text' + }, + '&[aria-expanded=true]': { + backgroundColor: 'btn.primary.selectedBg', + boxShadow: `${theme?.shadows.btn.primary.selectedShadow}` } }, danger: { @@ -87,6 +95,12 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme '[data-component="ButtonCounter"]': { color: 'btn.danger.text', backgroundColor: 'btn.danger.counterBg' + }, + '&[aria-expanded=true]': { + color: 'btn.danger.selectedText', + backgroundColor: 'btn.danger.selectedBg', + boxShadow: `${theme?.shadows.btn.danger.selectedShadow}`, + borderColor: 'btn.danger.selectedBorder' } }, invisible: { @@ -106,6 +120,9 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme }, '&:disabled': { color: 'primer.fg.disabled' + }, + '&[aria-expanded=true]': { + backgroundColor: 'btn.selectedBg' } }, outline: { @@ -146,6 +163,12 @@ export const getVariantStyles = (variant: VariantType = 'default', theme?: Theme '[data-component="ButtonCounter"]': { backgroundColor: 'btn.outline.counterBg', color: 'btn.outline.text' + }, + '&[aria-expanded=true]': { + color: 'btn.outline.selectedText', + backgroundColor: 'btn.outline.selectedBg', + boxShadow: `${theme?.shadows.btn.outline.selectedShadow}`, + borderColor: 'btn.outline.selectedBorder' } } } diff --git a/src/__tests__/__snapshots__/ActionMenu.test.tsx.snap b/src/__tests__/__snapshots__/ActionMenu.test.tsx.snap index a5c623a3d19..0e44dd1890b 100644 --- a/src/__tests__/__snapshots__/ActionMenu.test.tsx.snap +++ b/src/__tests__/__snapshots__/ActionMenu.test.tsx.snap @@ -87,8 +87,13 @@ exports[`ActionMenu renders consistently 1`] = ` } .c1:active:not([disabled]) { - background-color: hsla(220,14%,94%,1); - box-shadow: inset 0 0.15em 0.3em rgba(27,31,36,0.15); + background-color: hsla(220,14%,93%,1); + border-color: rgba(27,31,36,0.15); +} + +.c1[aria-expanded=true] { + background-color: hsla(220,14%,93%,1); + border-color: rgba(27,31,36,0.15); } .c1 [data-component=trailingIcon] { diff --git a/src/__tests__/__snapshots__/Button.test.tsx.snap b/src/__tests__/__snapshots__/Button.test.tsx.snap index 4a558a6a82b..1658279c070 100644 --- a/src/__tests__/__snapshots__/Button.test.tsx.snap +++ b/src/__tests__/__snapshots__/Button.test.tsx.snap @@ -76,8 +76,13 @@ exports[`Button renders consistently 1`] = ` } .c0:active:not([disabled]) { - background-color: hsla(220,14%,94%,1); - box-shadow: inset 0 0.15em 0.3em rgba(27,31,36,0.15); + background-color: hsla(220,14%,93%,1); + border-color: rgba(27,31,36,0.15); +} + +.c0[aria-expanded=true] { + background-color: hsla(220,14%,93%,1); + border-color: rgba(27,31,36,0.15); }