Skip to content

Commit

Permalink
UnderlineNav2: Add transparent outline for focus ring to support WHCM (
Browse files Browse the repository at this point in the history
…#3165)

* UnderlineNav2: Add outline for focus ring to support Windows High Contrast Mode

* add changeset

* snaps
  • Loading branch information
broccolinisoup committed Apr 13, 2023
1 parent 7272924 commit d749f49
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/green-crews-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

UnderlineNav2: Add transparent outline for focus to support WHCM
3 changes: 2 additions & 1 deletion src/UnderlineNav2/__snapshots__/UnderlineNav.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ exports[`UnderlineNav renders consistently 1`] = `
}
.c4:focus {
outline: 0;
outline: 2px solid transparent;
}
.c4:focus {
Expand All @@ -68,6 +68,7 @@ exports[`UnderlineNav renders consistently 1`] = `
}
.c4:focus-visible {
outline: 2px solid transparent;
box-shadow: inset 0 0 0 2px #0969da;
}
Expand Down
3 changes: 2 additions & 1 deletion src/UnderlineNav2/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const getLinkStyles = (
},
},
'&:focus': {
outline: 0,
outline: '2px solid transparent',
'&': {
boxShadow: `inset 0 0 0 2px ${theme?.colors.accent.fg}`,
},
Expand All @@ -104,6 +104,7 @@ export const getLinkStyles = (
},
},
'&:focus-visible': {
outline: '2px solid transparent',
boxShadow: `inset 0 0 0 2px ${theme?.colors.accent.fg}`,
},
// renders a visibly hidden "copy" of the label in bold, reserving box space for when label becomes bold on selected
Expand Down

0 comments on commit d749f49

Please sign in to comment.