Skip to content

Commit d749f49

Browse files
UnderlineNav2: Add transparent outline for focus ring to support WHCM (#3165)
* UnderlineNav2: Add outline for focus ring to support Windows High Contrast Mode * add changeset * snaps
1 parent 7272924 commit d749f49

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.changeset/green-crews-joke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': patch
3+
---
4+
5+
UnderlineNav2: Add transparent outline for focus to support WHCM

src/UnderlineNav2/__snapshots__/UnderlineNav.test.tsx.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ exports[`UnderlineNav renders consistently 1`] = `
5656
}
5757
5858
.c4:focus {
59-
outline: 0;
59+
outline: 2px solid transparent;
6060
}
6161
6262
.c4:focus {
@@ -68,6 +68,7 @@ exports[`UnderlineNav renders consistently 1`] = `
6868
}
6969
7070
.c4:focus-visible {
71+
outline: 2px solid transparent;
7172
box-shadow: inset 0 0 0 2px #0969da;
7273
}
7374

src/UnderlineNav2/styles.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const getLinkStyles = (
9494
},
9595
},
9696
'&:focus': {
97-
outline: 0,
97+
outline: '2px solid transparent',
9898
'&': {
9999
boxShadow: `inset 0 0 0 2px ${theme?.colors.accent.fg}`,
100100
},
@@ -104,6 +104,7 @@ export const getLinkStyles = (
104104
},
105105
},
106106
'&:focus-visible': {
107+
outline: '2px solid transparent',
107108
boxShadow: `inset 0 0 0 2px ${theme?.colors.accent.fg}`,
108109
},
109110
// renders a visibly hidden "copy" of the label in bold, reserving box space for when label becomes bold on selected

0 commit comments

Comments
 (0)