Skip to content

Commit b2d1af2

Browse files
authoredFeb 12, 2025··
[BpkSwitch] Adjust focus behaviour (#3737)
* fix: adjust focus ring behaviour to only show on keyboard + adjust radius to make it prettier * chore: adjust css * chore: adjust CSS to follow other rules
1 parent 12cebd6 commit b2d1af2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎packages/bpk-component-switch/src/BpkSwitch.module.scss

+5-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ $border-width: tokens.$bpk-one-pixel-rem * 2;
2929
display: flex;
3030
width: fit-content;
3131
align-items: center;
32-
33-
&:focus-within {
34-
@include utils.bpk-focus-indicator;
35-
}
32+
border-radius: $height * 0.5;
3633

3734
// Checkbox is invisible so the switch element can be the visual element.
3835
&__checkbox {
@@ -50,6 +47,10 @@ $border-width: tokens.$bpk-one-pixel-rem * 2;
5047
left: ($width - $height) + $border-width;
5148
}
5249
}
50+
51+
&:focus-visible ~ .bpk-switch__switch {
52+
@include utils.bpk-focus-indicator;
53+
}
5354
}
5455

5556
// The 'track'.

0 commit comments

Comments
 (0)
Please sign in to comment.