@@ -37,26 +37,10 @@ $hds-button-sizes: ("small", "medium", "large");
3737 cursor : not-allowed ;
3838}
3939
40- @mixin hds-button-state-focus () {
41- box-shadow : none ;
42-
43- // TEST: Replacement of pseudo-element-based focus ring
44- // &::before {
45- // // the position absolute of an element is computed from the inside of the border of the container
46- // // so we have to take in account the border width of the pseudo-element container itself
47- // $shift: calc(-1 * (var(--token-button-border-width) + var(--token-button-focus-border-width)));
48- // $radius: calc(var(--token-button-border-radius) + var(--token-button-focus-border-width));
49- // position: absolute;
50- // top: $shift;
51- // right: $shift;
52- // bottom: $shift;
53- // left: $shift;
54- // z-index: -1;
55- // border: var(--token-button-focus-border-width) solid transparent;
56- // border-radius: $radius;
57- // content: "";
58- // }
59- }
40+ // TODO: not needed if outline is used for the focus ring
41+ // @mixin hds-button-state-focus() {
42+ // box-shadow: none;
43+ // }
6044
6145@mixin hds-button-color-primary () {
6246 color : var (--token-button-foreground-color-primary-default );
@@ -77,27 +61,16 @@ $hds-button-sizes: ("small", "medium", "large");
7761 color : var (--token-button-foreground-color-primary-focus );
7862 background-color : var (--token-button-surface-color-primary-focus );
7963 border-color : var (--token-button-border-color-primary-focus-internal );
64+ // border-color: #fff; // TEST: add greater contrast & standardize with other variants (remove outline-offset)
8065
8166 // TEST: Replacement of pseudo-element-based focus ring
82- // border-color: #fff; // TEST: to add greater contrast
67+ // Test: outline instead of box-shadow
68+ outline : 3px solid var (--token-color-focus-action-external );
69+ outline-offset : 2px ; // non-standard (other Button variants don't use)
8370 // 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
87-
88- // &::before {
89- // // the position absolute of an element is computed from the inside of the border of the container
90- // // so we have to take in account the border width of the pseudo-element container itself
91- // // plus for the primary button we want to have a 2px gap between the button and the focus
92- // $shift: calc(-1 * (var(--token-button-border-width) + var(--token-button-focus-border-width) + 2px));
93- // $radius: calc(var(--token-button-border-radius) + var(--token-button-focus-border-width) + 2px);
94- // top: $shift;
95- // right: $shift;
96- // bottom: $shift;
97- // left: $shift;
98- // border-color: var(--token-button-border-color-primary-focus-external);
99- // border-radius: $radius;
100- // }
71+ // box-shadow:
72+ // 0 0 0 2px #fff,
73+ // 0 0 0 5px var(--token-color-focus-action-external); // similar to original style using pseudo-element
10174 }
10275
10376 & :active ,
@@ -106,10 +79,6 @@ $hds-button-sizes: ("small", "medium", "large");
10679 background-color : var (--token-button-surface-color-primary-active );
10780 border-color : var (--token-button-border-color-primary-active );
10881 box-shadow : none ;
109-
110- & ::before {
111- border-color : transparent ;
112- }
11382 }
11483}
11584
@@ -134,11 +103,9 @@ $hds-button-sizes: ("small", "medium", "large");
134103 border-color : var (--token-button-border-color-secondary-focus-internal );
135104
136105 // TEST: Replacement of pseudo-element-based focus ring
137- box-shadow : 0 0 0 3px var (--token-button-border-color-secondary-focus-external );
138-
139- // &::before {
140- // border-color: var(--token-button-border-color-secondary-focus-external);
141- // }
106+ // Test: outline instead of box-shadow
107+ outline : 3px solid var (--token-button-border-color-secondary-focus-external );
108+ // box-shadow: 0 0 0 3px var(--token-button-border-color-secondary-focus-external);
142109 }
143110
144111 & :active ,
@@ -147,10 +114,6 @@ $hds-button-sizes: ("small", "medium", "large");
147114 background-color : var (--token-button-surface-color-secondary-active );
148115 border-color : var (--token-button-border-color-secondary-active );
149116 box-shadow : none ;
150-
151- & ::before {
152- border-color : transparent ;
153- }
154117 }
155118}
156119
@@ -174,11 +137,9 @@ $hds-button-sizes: ("small", "medium", "large");
174137 border-color : var (--token-button-border-color-tertiary-focus-internal );
175138
176139 // TEST: Replacement of pseudo-element-based focus ring
177- box-shadow : 0 0 0 3px var (--token-button-border-color-tertiary-focus-external );
178-
179- // &::before {
180- // border-color: var(--token-button-border-color-tertiary-focus-external);
181- // }
140+ // Test: outline instead of box-shadow
141+ outline : 3px solid var (--token-button-border-color-tertiary-focus-external );
142+ // box-shadow: 0 0 0 3px var(--token-button-border-color-tertiary-focus-external);
182143 }
183144
184145 & :active ,
@@ -187,10 +148,6 @@ $hds-button-sizes: ("small", "medium", "large");
187148 background-color : var (--token-button-surface-color-tertiary-active );
188149 border-color : var (--token-button-border-color-tertiary-active );
189150 box-shadow : none ;
190-
191- & ::before {
192- border-color : transparent ;
193- }
194151 }
195152
196153 //
@@ -209,10 +166,6 @@ $hds-button-sizes: ("small", "medium", "large");
209166 & .mock-disabled :hover {
210167 background-color : transparent ;
211168 border-color : transparent ;
212-
213- & ::before {
214- border-color : transparent ;
215- }
216169 }
217170}
218171
@@ -237,11 +190,9 @@ $hds-button-sizes: ("small", "medium", "large");
237190 border-color : var (--token-button-border-color-critical-focus-internal );
238191
239192 // TEST: Replacement of pseudo-element-based focus ring
240- box-shadow : 0 0 0 3px var (--token-button-border-color-critical-focus-external );
241-
242- // &::before {
243- // border-color: var(--token-button-border-color-critical-focus-external);
244- // }
193+ // Test: outline instead of box-shadow
194+ outline : 3px solid var (--token-button-border-color-critical-focus-external );
195+ // box-shadow: 0 0 0 3px var(--token-button-border-color-critical-focus-external);
245196 }
246197
247198 & :active ,
@@ -250,10 +201,6 @@ $hds-button-sizes: ("small", "medium", "large");
250201 background-color : var (--token-button-surface-color-critical-active );
251202 border-color : var (--token-button-border-color-critical-active );
252203 box-shadow : none ;
253-
254- & ::before {
255- border-color : transparent ;
256- }
257204 }
258205}
259206
0 commit comments