Skip to content

Commit 3652163

Browse files
KristinLBradleydidoo
authored andcommitted
HDS-5666 Style Promary Button focus style to visually match original
1 parent 59101d3 commit 3652163

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

packages/components/src/styles/mixins/_button.scss

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ $hds-button-sizes: ("small", "medium", "large");
7676
&.mock-focus {
7777
color: var(--token-button-foreground-color-primary-focus);
7878
background-color: var(--token-button-surface-color-primary-focus);
79-
// border-color: var(--token-button-border-color-primary-focus-internal);
79+
border-color: var(--token-button-border-color-primary-focus-internal);
8080

8181
// TEST: Replacement of pseudo-element-based focus ring
82-
border-color: #fff; // TEST: to add greater contrast
83-
box-shadow: 0 0 0 3px var(--token-color-focus-action-external); // standardized w/ other variants
84-
// box-shadow: 0 0 0 1px #fff, 0 0 0 4px var(--token-color-focus-action-external); // closer to original style
82+
// border-color: #fff; // TEST: to add greater contrast
83+
// box-shadow: 0 0 0 3px var(--token-color-focus-action-external); // standardized w/ other variants
84+
box-shadow:
85+
0 0 0 2px #fff,
86+
0 0 0 5px var(--token-color-focus-action-external); // similar to original style using pseudo-element
8587

8688
// &::before {
8789
// // the position absolute of an element is computed from the inside of the border of the container

showcase/public/assets/styles/@hashicorp/design-system-components-common.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3110,8 +3110,8 @@ a.hds-button:hover, a.hds-button:focus, a.hds-button:active, a.hds-button.mock-h
31103110
.hds-button--color-primary:focus, .hds-button--color-primary.mock-focus {
31113111
color: var(--token-button-foreground-color-primary-focus);
31123112
background-color: var(--token-button-surface-color-primary-focus);
3113-
border-color: #fff;
3114-
box-shadow: 0 0 0 3px var(--token-color-focus-action-external);
3113+
border-color: var(--token-button-border-color-primary-focus-internal);
3114+
box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--token-color-focus-action-external);
31153115
}
31163116
.hds-button--color-primary:active, .hds-button--color-primary.mock-active {
31173117
color: var(--token-button-foreground-color-primary-active);
@@ -4537,8 +4537,8 @@ button.hds-button[href]::after {
45374537
.hds-dropdown-toggle-button--color-primary:focus, .hds-dropdown-toggle-button--color-primary.mock-focus {
45384538
color: var(--token-button-foreground-color-primary-focus);
45394539
background-color: var(--token-button-surface-color-primary-focus);
4540-
border-color: #fff;
4541-
box-shadow: 0 0 0 3px var(--token-color-focus-action-external);
4540+
border-color: var(--token-button-border-color-primary-focus-internal);
4541+
box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--token-color-focus-action-external);
45424542
}
45434543
.hds-dropdown-toggle-button--color-primary:active, .hds-dropdown-toggle-button--color-primary.mock-active {
45444544
color: var(--token-button-foreground-color-primary-active);

showcase/public/assets/styles/@hashicorp/design-system-components.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3646,8 +3646,8 @@ a.hds-button:hover, a.hds-button:focus, a.hds-button:active, a.hds-button.mock-h
36463646
.hds-button--color-primary:focus, .hds-button--color-primary.mock-focus {
36473647
color: var(--token-button-foreground-color-primary-focus);
36483648
background-color: var(--token-button-surface-color-primary-focus);
3649-
border-color: #fff;
3650-
box-shadow: 0 0 0 3px var(--token-color-focus-action-external);
3649+
border-color: var(--token-button-border-color-primary-focus-internal);
3650+
box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--token-color-focus-action-external);
36513651
}
36523652
.hds-button--color-primary:active, .hds-button--color-primary.mock-active {
36533653
color: var(--token-button-foreground-color-primary-active);
@@ -5073,8 +5073,8 @@ button.hds-button[href]::after {
50735073
.hds-dropdown-toggle-button--color-primary:focus, .hds-dropdown-toggle-button--color-primary.mock-focus {
50745074
color: var(--token-button-foreground-color-primary-focus);
50755075
background-color: var(--token-button-surface-color-primary-focus);
5076-
border-color: #fff;
5077-
box-shadow: 0 0 0 3px var(--token-color-focus-action-external);
5076+
border-color: var(--token-button-border-color-primary-focus-internal);
5077+
box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--token-color-focus-action-external);
50785078
}
50795079
.hds-dropdown-toggle-button--color-primary:active, .hds-dropdown-toggle-button--color-primary.mock-active {
50805080
color: var(--token-button-foreground-color-primary-active);

0 commit comments

Comments
 (0)