Skip to content

Commit 3e54c13

Browse files
langermankjoshblack
authored andcommitted
Remove deprecated focus style primitives (#2510)
* remove deprecated primitives * Create afraid-wombats-drive.md * snippy snaps * move to draft directory * fix focus color * test: update snapshots Co-authored-by: Josh Black <josh@josh.black>
1 parent 8b824d1 commit 3e54c13

18 files changed

+29
-42
lines changed

.changeset/afraid-wombats-drive.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+
Remove deprecated focus style primitives

src/SideNav.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,13 @@ type StyledSideNavLinkProps = {
6262
// used for variant normal hover, focus pseudo selectors
6363
const CommonAccessibilityVariantNormalStyles = css`
6464
background-color: ${get('colors.neutral.subtle')};
65-
outline: none;
6665
text-decoration: none;
6766
`
6867

6968
// used for light weight hover, focus pseudo selectors
7069
const CommonAccessibilityVariantLightWeightStyles = css`
7170
color: ${get('colors.fg.default')};
7271
text-decoration: none;
73-
outline: none;
7472
`
7573

7674
const SideNavLink = styled(Link).attrs<StyledSideNavLinkProps>(props => {
@@ -135,7 +133,7 @@ const SideNavLink = styled(Link).attrs<StyledSideNavLinkProps>(props => {
135133
136134
&:focus {
137135
${CommonAccessibilityVariantNormalStyles}
138-
box-shadow: ${get('shadows.primer.shadow.focus')};
136+
outline: solid 2px ${get('colors.accent.fg')};
139137
z-index: 1;
140138
}
141139
@@ -160,7 +158,7 @@ const SideNavLink = styled(Link).attrs<StyledSideNavLinkProps>(props => {
160158
161159
&:focus {
162160
${CommonAccessibilityVariantLightWeightStyles}
163-
box-shadow: ${get('shadows.primer.shadow.focus')};
161+
outline: solid 1px ${get('colors.accent.fg')};
164162
z-index: 1;
165163
}
166164

src/__tests__/__snapshots__/AnchoredOverlay.test.tsx.snap

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ exports[`AnchoredOverlay renders consistently 1`] = `
5858
}
5959
6060
.c1:focus {
61-
border-color: rgba(27,31,36,0.15);
62-
box-shadow: 0 0 0 3px rgba(9,105,218,0.3);
61+
outline: solid 2px #0969da;
6362
}
6463
6564
.c1:active {
@@ -150,8 +149,7 @@ exports[`AnchoredOverlay should render consistently when open 1`] = `
150149
}
151150
152151
.c1:focus {
153-
border-color: rgba(27,31,36,0.15);
154-
box-shadow: 0 0 0 3px rgba(9,105,218,0.3);
152+
outline: solid 2px #0969da;
155153
}
156154
157155
.c1:active {

src/__tests__/__snapshots__/ConfirmationDialog.test.tsx.snap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ exports[`ConfirmationDialog renders consistently 1`] = `
5858
}
5959
6060
.c1:focus {
61-
border-color: rgba(27,31,36,0.15);
62-
box-shadow: 0 0 0 3px rgba(9,105,218,0.3);
61+
outline: solid 2px #0969da;
6362
}
6463
6564
.c1:active {

src/__tests__/__snapshots__/Dialog.test.tsx.snap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ exports[`Dialog renders consistently 1`] = `
6565
border: none;
6666
padding: 0;
6767
background: transparent;
68-
outline: none;
6968
cursor: pointer;
7069
border-radius: 6px;
7170
color: #57606a;
@@ -75,7 +74,7 @@ exports[`Dialog renders consistently 1`] = `
7574
}
7675
7776
.c1:focus {
78-
box-shadow: 0 0 0 3px rgba(9,105,218,0.3);
77+
outline: solid 2px #0969da;
7978
}
8079
8180
.c1:hover {

src/__tests__/__snapshots__/Dropdown.test.tsx.snap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ exports[`Dropdown.Button renders consistently 1`] = `
7474
}
7575
7676
.c0:focus {
77-
border-color: rgba(27,31,36,0.15);
78-
box-shadow: 0 0 0 3px rgba(9,105,218,0.3);
77+
outline: solid 2px #0969da;
7978
}
8079
8180
.c0:active {

src/__tests__/__snapshots__/SelectMenu.test.tsx.snap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ exports[`SelectMenu right-aligned modal has right: 0px 1`] = `
5252
}
5353
5454
.c1:focus {
55-
border-color: rgba(27,31,36,0.15);
56-
box-shadow: 0 0 0 3px rgba(9,105,218,0.3);
55+
outline: solid 2px #0969da;
5756
}
5857
5958
.c1:active {

src/__tests__/__snapshots__/SelectPanel.test.tsx.snap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ exports[`SelectPanel renders consistently 1`] = `
5858
}
5959
6060
.c1:focus {
61-
border-color: rgba(27,31,36,0.15);
62-
box-shadow: 0 0 0 3px rgba(9,105,218,0.3);
61+
outline: solid 2px #0969da;
6362
}
6463
6564
.c1:active {

src/__tests__/__snapshots__/SideNav.test.tsx.snap

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,15 @@ exports[`SideNav SideNav.Link renders consistently 1`] = `
6969
7070
.c1.variant-normal > .c0:hover {
7171
background-color: rgba(234,238,242,0.5);
72-
outline: none;
7372
-webkit-text-decoration: none;
7473
text-decoration: none;
7574
}
7675
7776
.c1.variant-normal > .c0:focus {
7877
background-color: rgba(234,238,242,0.5);
79-
outline: none;
8078
-webkit-text-decoration: none;
8179
text-decoration: none;
82-
box-shadow: 0 0 0 3px rgba(9,105,218,0.3);
80+
outline: solid 2px #0969da;
8381
z-index: 1;
8482
}
8583
@@ -102,15 +100,13 @@ exports[`SideNav SideNav.Link renders consistently 1`] = `
102100
color: #24292f;
103101
-webkit-text-decoration: none;
104102
text-decoration: none;
105-
outline: none;
106103
}
107104
108105
.c1.variant-lightweight > .c0:focus {
109106
color: #24292f;
110107
-webkit-text-decoration: none;
111108
text-decoration: none;
112-
outline: none;
113-
box-shadow: 0 0 0 3px rgba(9,105,218,0.3);
109+
outline: solid 1px #0969da;
114110
z-index: 1;
115111
}
116112

src/__tests__/deprecated/__snapshots__/ActionMenu.test.tsx.snap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ exports[`ActionMenu renders consistently 1`] = `
5252
}
5353
5454
.c0:focus {
55-
border-color: rgba(27,31,36,0.15);
56-
box-shadow: 0 0 0 3px rgba(9,105,218,0.3);
55+
outline: solid 2px #0969da;
5756
}
5857
5958
.c0:active {

0 commit comments

Comments
 (0)