@@ -274,9 +274,18 @@ $hds-dropdown-toggle-border-radius: 5px;
274
274
// Notice: to avoid too much duplication we define two local CSS variables
275
275
// and define their values in the color variants below
276
276
277
+ & :hover ,
278
+ & .is-hover {
279
+ color : var (--current-color-hover );
280
+ & ::before {
281
+ background-color : currentColor ;
282
+ }
283
+ }
284
+
277
285
// default focus for browsers that still rely on ":focus"
278
286
& :focus ,
279
287
& .is-focus {
288
+ color : var (--current-color-focus );
280
289
& ::after {
281
290
background-color : var (--current-background-color );
282
291
box-shadow : var (--current-focus-ring-box-shadow );
@@ -286,22 +295,39 @@ $hds-dropdown-toggle-border-radius: 5px;
286
295
// undo the previous declaration for browsers that support ":focus-visible" but wouldn't normally show default focus styles
287
296
& :focus:not (:focus-visible ) {
288
297
& ::after {
298
+ background-color : transparent ;
289
299
box-shadow : none ;
290
300
}
291
301
}
292
302
// set focus for browsers that support ":focus-visible"
293
303
& :focus-visible {
304
+ color : var (--current-color-focus );
294
305
& ::after {
295
306
background-color : var (--current-background-color );
296
307
box-shadow : var (--current-focus-ring-box-shadow );
297
308
left : 4px ;
298
309
}
299
310
}
311
+
300
312
// remove the focus ring on "active + focused" state (by design)
301
313
& :focus:active ,
314
+ & :focus-visible:active ,
302
315
& .is-focus.is-active {
303
316
& ::after {
317
+ background-color : var (--current-background-color );
304
318
box-shadow : none ;
319
+ left : 10px ;
320
+ }
321
+ }
322
+
323
+ & :active ,
324
+ & .is-active {
325
+ color : var (--current-color-active );
326
+ & ::before {
327
+ background-color : currentColor ;
328
+ }
329
+ & ::after {
330
+ background-color : var (--current-background-color );
305
331
}
306
332
}
307
333
}
@@ -320,30 +346,12 @@ $hds-dropdown-toggle-border-radius: 5px;
320
346
color : var (--token-color-foreground-primary );
321
347
322
348
// assign the values to the local CSS variables used above
349
+ --current-color-hover : var (--token-color-foreground-action-hover );
350
+ --current-color-focus : var (--token-color-foreground-action-active );
351
+ --current-color-active : var (--token-color-foreground-action-active );
323
352
& ::after {
324
353
--current-background-color : var (--token-color-surface-action );
325
- --current-focus-ring-box-shadow : var (
326
- --token-focus-ring-action-box-shadow
327
- );
328
- }
329
-
330
- & :hover ,
331
- & .is-hover {
332
- color : var (--token-color-foreground-action-hover );
333
- & ::before {
334
- background-color : currentColor ;
335
- }
336
- }
337
-
338
- & :active ,
339
- & .is-active {
340
- color : var (--token-color-foreground-action-active );
341
- & ::before {
342
- background-color : currentColor ;
343
- }
344
- & ::after {
345
- background-color : var (--token-color-surface-action );
346
- }
354
+ --current-focus-ring-box-shadow : var (--token-focus-ring-action-box-shadow );
347
355
}
348
356
}
349
357
}
@@ -353,28 +361,13 @@ $hds-dropdown-toggle-border-radius: 5px;
353
361
color : var (--token-color-foreground-critical );
354
362
355
363
// assign the values to the local CSS variables used above
364
+ --current-color-hover : var (--token-color-palette-red-300 );
365
+ --current-color-focus : var (--token-color-palette-red-400 );
366
+ --current-color-active : var (--token-color-palette-red-400 );
356
367
& ::after {
357
368
--current-background-color : var (--token-color-surface-critical );
358
369
--current-focus-ring-box-shadow : var (--token-focus-ring-critical-box-shadow );
359
370
}
360
-
361
- & :hover ,
362
- & .is-hover {
363
- color : var (--token-color-palette-red-300 );
364
- & ::before {
365
- background-color : currentColor ;
366
- }
367
- }
368
- & :active ,
369
- & .is-active {
370
- color : var (--token-color-palette-red-400 );
371
- & ::before {
372
- background-color : currentColor ;
373
- }
374
- & ::after {
375
- background-color : var (--token-color-surface-critical );
376
- }
377
- }
378
371
}
379
372
}
380
373
0 commit comments