@@ -63,7 +63,7 @@ governing permissions and limitations under the License.
63
63
--spectrum-actionbutton-background-color-focus : var (--spectrum-gray-200 );
64
64
--spectrum-actionbutton-background-color-disabled : transparent;
65
65
66
- & .is-selected {
66
+ & : where ( .is-selected , [ aria-pressed = "true" ] , [ aria-expanded = "true" ]) {
67
67
--spectrum-actionbutton-background-color-disabled : var (--spectrum-disabled-background-color );
68
68
}
69
69
}
@@ -116,7 +116,8 @@ governing permissions and limitations under the License.
116
116
}
117
117
}
118
118
119
- & .is-selected {
119
+ /* expanded is specific to action menu when the menu is open */
120
+ & : where (.is-selected , [aria-pressed = "true" ], [aria-expanded = "true" ]) {
120
121
--mod-actionbutton-background-color-default : var (--mod-actionbutton-background-color-default-selected , var (--spectrum-neutral-background-color-selected-default ));
121
122
--mod-actionbutton-background-color-hover : var (--mod-actionbutton-background-color-hover-selected , var (--spectrum-neutral-background-color-selected-hover ));
122
123
--mod-actionbutton-background-color-down : var (--mod-actionbutton-background-color-down-selected , var (--spectrum-neutral-background-color-selected-down ));
@@ -298,6 +299,16 @@ governing permissions and limitations under the License.
298
299
border-style : none;
299
300
}
300
301
302
+ & ::after {
303
+ position : absolute;
304
+ inset : 0 ;
305
+ margin : calc ((var (--spectrum-actionbutton-focus-indicator-gap ) + var (--spectrum-actionbutton-border-width )) * -1 );
306
+ border-radius : var (--spectrum-actionbutton-focus-indicator-border-radius );
307
+ transition : box-shadow var (--highcontrast-actionbutton-animation-duration , var (--spectrum-actionbutton-animation-duration )) ease-in-out;
308
+ pointer-events : none;
309
+ content : "" ;
310
+ }
311
+
301
312
& : focus {
302
313
outline : none;
303
314
}
@@ -315,6 +326,13 @@ governing permissions and limitations under the License.
315
326
& : focus-visible {
316
327
background-color : var (--highcontrast-actionbutton-background-color-default , var (--mod-actionbutton-background-color-focus , var (--spectrum-actionbutton-background-color-focus )));
317
328
color : var (--highcontrast-actionbutton-content-color-default , var (--mod-actionbutton-content-color-focus , var (--spectrum-actionbutton-content-color-focus )));
329
+
330
+ box-shadow : none;
331
+ outline : none;
332
+
333
+ & ::after {
334
+ box-shadow : 0 0 0 var (--spectrum-actionbutton-focus-indicator-thickness ) var (--highcontrast-actionbutton-focus-indicator-color , var (--spectrum-actionbutton-focus-indicator-color ));
335
+ }
318
336
}
319
337
320
338
& : active {
@@ -323,8 +341,8 @@ governing permissions and limitations under the License.
323
341
transform : perspective (var (--spectrum-actionbutton-downstate-perspective )) translateZ (var (--spectrum-component-size-difference-down ));
324
342
}
325
343
326
- & : disabled ,
327
- & .is-disabled {
344
+ /* ideal when we want to disable the button but still allow it's content to be focused */
345
+ & : where ( : disabled , .is-disabled , [ aria-disabled = "true" ]) {
328
346
background-color : var (--highcontrast-actionbutton-background-color-disabled , var (--mod-actionbutton-background-color-disabled , var (--spectrum-actionbutton-background-color-disabled )));
329
347
color : var (--highcontrast-actionbutton-content-color-disabled , var (--mod-actionbutton-content-color-disabled , var (--spectrum-actionbutton-content-color-disabled )));
330
348
}
@@ -364,10 +382,6 @@ a.spectrum-ActionButton {
364
382
/* Fixes horizontal alignment of text in anchor buttons */
365
383
text-align : center;
366
384
367
- & : empty {
368
- display : none;
369
- }
370
-
371
385
pointer-events : none;
372
386
373
387
font-size : var (--mod-actionbutton-font-size , var (--spectrum-actionbutton-font-size ));
@@ -378,40 +392,21 @@ a.spectrum-ActionButton {
378
392
379
393
text-overflow : ellipsis;
380
394
overflow : hidden;
395
+
396
+ & : empty {
397
+ display : none;
398
+ }
381
399
}
382
400
383
401
.spectrum-ActionButton-hold {
384
402
position : absolute;
385
403
inset-inline-end : calc (var (--mod-actionbutton-edge-to-hold-icon , var (--spectrum-actionbutton-edge-to-hold-icon )) - var (--spectrum-actionbutton-border-width ));
386
404
inset-block-end : calc (var (--mod-actionbutton-edge-to-hold-icon , var (--spectrum-actionbutton-edge-to-hold-icon )) - var (--spectrum-actionbutton-border-width ));
405
+ display : block;
387
406
color : inherit;
388
407
transform : var (--spectrum-logical-rotation );
389
408
}
390
409
391
- /* Focus indicator */
392
- .spectrum-ActionButton {
393
- transition : border-color var (--highcontrast-actionbutton-animation-duration , var (--mod-actionbutton-animation-duration , var (--spectrum-actionbutton-animation-duration ))) ease-in-out;
394
-
395
- & ::after {
396
- position : absolute;
397
- inset : 0 ;
398
- margin : calc ((var (--mod-actionbutton-focus-indicator-gap , var (--spectrum-actionbutton-focus-indicator-gap )) + var (--spectrum-actionbutton-border-width )) * -1 );
399
- border-radius : var (--mod-actionbutton-focus-indicator-border-radius , var (--spectrum-actionbutton-focus-indicator-border-radius ));
400
- transition : box-shadow var (--highcontrast-actionbutton-animation-duration , var (--mod-actionbutton-animation-duration , var (--spectrum-actionbutton-animation-duration ))) ease-in-out;
401
- pointer-events : none;
402
- content : "" ;
403
- }
404
-
405
- & : focus-visible {
406
- box-shadow : none;
407
- outline : none;
408
-
409
- & ::after {
410
- box-shadow : 0 0 0 var (--mod-actionbutton-focus-indicator-thickness , var (--spectrum-actionbutton-focus-indicator-thickness )) var (--highcontrast-actionbutton-focus-indicator-color , var (--mod-actionbutton-focus-indicator-color , var (--spectrum-actionbutton-focus-indicator-color )));
411
- }
412
- }
413
- }
414
-
415
410
@media (forced-colors : active) {
416
411
.spectrum-ActionButton {
417
412
/**
@@ -457,7 +452,7 @@ a.spectrum-ActionButton {
457
452
--highcontrast-actionbutton-background-color-disabled : Canvas;
458
453
--highcontrast-actionbutton-content-color-default : CanvasText;
459
454
460
- & : disabled : not (.is-selected ) {
455
+ & : where ( : disabled , . is-disabled , [ aria-disabled = "true" ]) : not (: where ( .is-selected , [ aria-pressed = "true" ] , [ aria-expanded = "true" ]) ) {
461
456
--highcontrast-actionbutton-border-color : Canvas;
462
457
}
463
458
}
@@ -469,8 +464,7 @@ a.spectrum-ActionButton {
469
464
--highcontrast-actionbutton-border-color : Highlight;
470
465
}
471
466
472
- /* Selected always shows as a solid highlighted color. */
473
- & .is-selected {
467
+ & : where (.is-selected , [aria-pressed = "true" ], [aria-expanded = "true" ]) {
474
468
--highcontrast-actionbutton-border-color : Highlight;
475
469
--highcontrast-actionbutton-background-color-default : Highlight;
476
470
--highcontrast-actionbutton-content-color-default : HighlightText;
0 commit comments