Skip to content

Commit 7e4f771

Browse files
Remove incorrect focus styles on ActionList items (#3056)
* remove incorrect focus style * Create .changeset/chilled-icons-hammer.md * test(vrt): update snapshots * test(e2e): remove DataTable snapshots --------- Co-authored-by: langermank <[email protected]> Co-authored-by: Josh Black <[email protected]>
1 parent 0c03e8e commit 7e4f771

File tree

3 files changed

+22
-79
lines changed

3 files changed

+22
-79
lines changed

.changeset/chilled-icons-hammer.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 incorrect focus styles on ActionList items

src/ActionList/Item.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,7 @@ export const Item = React.forwardRef<HTMLLIElement, ActionListItemProps>(
9292
backgroundColor: `actionListItem.${variant}.hoverBg`,
9393
color: getVariantStyles(variant, disabled).hoverColor,
9494
},
95-
':focus:not([data-focus-visible-added]), > a:focus:not([data-focus-visible-added])': {
96-
backgroundColor: `actionListItem.${variant}.selectedBg`,
97-
color: getVariantStyles(variant, disabled).hoverColor,
98-
outline: 'none',
99-
},
100-
'&[data-focus-visible-added], > a[data-focus-visible-added]': {
101-
// we don't use :focus-visible because not all browsers (safari) have it yet
95+
'&:focus-visible, > a:focus-visible': {
10296
outline: 'none',
10397
border: `2 solid`,
10498
boxShadow: `0 0 0 2px ${theme?.colors.accent.emphasis}`,

src/NavList/__snapshots__/NavList.test.tsx.snap

Lines changed: 16 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,8 @@ exports[`NavList renders a simple list 1`] = `
239239
color: #24292f;
240240
}
241241
242-
.c2:focus:not([data-focus-visible-added]),
243-
.c2 > a:focus:not([data-focus-visible-added]) {
244-
background-color: rgba(208,215,222,0.24);
245-
color: #24292f;
246-
outline: none;
247-
}
248-
249-
.c2[data-focus-visible-added],
250-
.c2 > a[data-focus-visible-added] {
242+
.c2:focus-visible,
243+
.c2 > a:focus-visible {
251244
outline: none;
252245
border: 2 solid;
253246
box-shadow: 0 0 0 2px #0969da;
@@ -271,15 +264,8 @@ exports[`NavList renders a simple list 1`] = `
271264
color: #24292f;
272265
}
273266
274-
.c6:focus:not([data-focus-visible-added]),
275-
.c6 > a:focus:not([data-focus-visible-added]) {
276-
background-color: rgba(208,215,222,0.24);
277-
color: #24292f;
278-
outline: none;
279-
}
280-
281-
.c6[data-focus-visible-added],
282-
.c6 > a[data-focus-visible-added] {
267+
.c6:focus-visible,
268+
.c6 > a:focus-visible {
283269
outline: none;
284270
border: 2 solid;
285271
box-shadow: 0 0 0 2px #0969da;
@@ -649,15 +635,8 @@ exports[`NavList renders with groups 1`] = `
649635
color: #24292f;
650636
}
651637
652-
.c6:focus:not([data-focus-visible-added]),
653-
.c6 > a:focus:not([data-focus-visible-added]) {
654-
background-color: rgba(208,215,222,0.24);
655-
color: #24292f;
656-
outline: none;
657-
}
658-
659-
.c6[data-focus-visible-added],
660-
.c6 > a[data-focus-visible-added] {
638+
.c6:focus-visible,
639+
.c6 > a:focus-visible {
661640
outline: none;
662641
border: 2 solid;
663642
box-shadow: 0 0 0 2px #0969da;
@@ -681,15 +660,8 @@ exports[`NavList renders with groups 1`] = `
681660
color: #24292f;
682661
}
683662
684-
.c10:focus:not([data-focus-visible-added]),
685-
.c10 > a:focus:not([data-focus-visible-added]) {
686-
background-color: rgba(208,215,222,0.24);
687-
color: #24292f;
688-
outline: none;
689-
}
690-
691-
.c10[data-focus-visible-added],
692-
.c10 > a[data-focus-visible-added] {
663+
.c10:focus-visible,
664+
.c10 > a:focus-visible {
693665
outline: none;
694666
border: 2 solid;
695667
box-shadow: 0 0 0 2px #0969da;
@@ -1141,15 +1113,8 @@ exports[`NavList.Item with NavList.SubNav does not have active styles if SubNav
11411113
color: #24292f;
11421114
}
11431115
1144-
.c10:focus:not([data-focus-visible-added]),
1145-
.c10 > a:focus:not([data-focus-visible-added]) {
1146-
background-color: rgba(208,215,222,0.24);
1147-
color: #24292f;
1148-
outline: none;
1149-
}
1150-
1151-
.c10[data-focus-visible-added],
1152-
.c10 > a[data-focus-visible-added] {
1116+
.c10:focus-visible,
1117+
.c10 > a:focus-visible {
11531118
outline: none;
11541119
border: 2 solid;
11551120
box-shadow: 0 0 0 2px #0969da;
@@ -1173,15 +1138,8 @@ exports[`NavList.Item with NavList.SubNav does not have active styles if SubNav
11731138
color: #24292f;
11741139
}
11751140
1176-
.c3:focus:not([data-focus-visible-added]),
1177-
.c3 > a:focus:not([data-focus-visible-added]) {
1178-
background-color: rgba(208,215,222,0.24);
1179-
color: #24292f;
1180-
outline: none;
1181-
}
1182-
1183-
.c3[data-focus-visible-added],
1184-
.c3 > a[data-focus-visible-added] {
1141+
.c3:focus-visible,
1142+
.c3 > a:focus-visible {
11851143
outline: none;
11861144
border: 2 solid;
11871145
box-shadow: 0 0 0 2px #0969da;
@@ -1628,15 +1586,8 @@ exports[`NavList.Item with NavList.SubNav has active styles if SubNav contains t
16281586
color: #24292f;
16291587
}
16301588
1631-
.c10:focus:not([data-focus-visible-added]),
1632-
.c10 > a:focus:not([data-focus-visible-added]) {
1633-
background-color: rgba(208,215,222,0.24);
1634-
color: #24292f;
1635-
outline: none;
1636-
}
1637-
1638-
.c10[data-focus-visible-added],
1639-
.c10 > a[data-focus-visible-added] {
1589+
.c10:focus-visible,
1590+
.c10 > a:focus-visible {
16401591
outline: none;
16411592
border: 2 solid;
16421593
box-shadow: 0 0 0 2px #0969da;
@@ -1660,15 +1611,8 @@ exports[`NavList.Item with NavList.SubNav has active styles if SubNav contains t
16601611
color: #24292f;
16611612
}
16621613
1663-
.c3:focus:not([data-focus-visible-added]),
1664-
.c3 > a:focus:not([data-focus-visible-added]) {
1665-
background-color: rgba(208,215,222,0.24);
1666-
color: #24292f;
1667-
outline: none;
1668-
}
1669-
1670-
.c3[data-focus-visible-added],
1671-
.c3 > a[data-focus-visible-added] {
1614+
.c3:focus-visible,
1615+
.c3 > a:focus-visible {
16721616
outline: none;
16731617
border: 2 solid;
16741618
box-shadow: 0 0 0 2px #0969da;

0 commit comments

Comments
 (0)