Skip to content

Commit 70005b8

Browse files
authoredDec 3, 2024··
BugFix: Use first-of-type for buttongroup selector (#5343)
* BugFix: Use first-of-type for buttongroup selector * test(vrt): update snapshots * Create big-jokes-jog.md --------- Co-authored-by: jonrohan <jonrohan@users.noreply.github.com>
1 parent d1dc7fa commit 70005b8

14 files changed

+11
-6
lines changed
 

‎.changeset/big-jokes-jog.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
BugFix: Fix issue in ButtonGroup Overlay screenshots by updating the selector to use `:is(button, a)` and `:first-of-type` and `:last-of-type` pseudo-classes.

Error rendering embedded code

Invalid image source.

Error rendering embedded code

Invalid image source.

Error rendering embedded code

Invalid image source.

Error rendering embedded code

Invalid image source.

Error rendering embedded code

Invalid image source.

Error rendering embedded code

Invalid image source.

Error rendering embedded code

Invalid image source.

Error rendering embedded code

Invalid image source.

Error rendering embedded code

Invalid image source.

Error rendering embedded code

Invalid image source.

Error rendering embedded code

Invalid image source.

‎packages/react/src/ButtonGroup/ButtonGroup.module.css

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
vertical-align: middle;
44
isolation: isolate;
55

6-
& > *:not([data-loading-wrapper]) {
6+
& > *:not([data-loading-wrapper]):is(button, a) {
77
/* stylelint-disable-next-line primer/spacing */
88
margin-inline-end: -1px;
99
position: relative;
1010
border-radius: 0;
1111

12-
&:first-child {
12+
&:first-of-type {
1313
border-top-left-radius: var(--borderRadius-medium);
1414
border-bottom-left-radius: var(--borderRadius-medium);
1515
}
1616

17-
&:last-child {
17+
&:last-of-type {
1818
border-top-right-radius: var(--borderRadius-medium);
1919
border-bottom-right-radius: var(--borderRadius-medium);
2020
}

‎packages/react/src/ButtonGroup/ButtonGroup.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ const StyledButtonGroup = toggleStyledComponent(
1919
vertical-align: middle;
2020
isolation: isolate;
2121
22-
&& > *:not([data-loading-wrapper]) {
22+
&& > *:not([data-loading-wrapper]):is(button, a) {
2323
margin-inline-end: -1px;
2424
position: relative;
2525
border-radius: 0;
2626
27-
:first-child {
27+
:first-of-type {
2828
border-top-left-radius: ${get('radii.2')};
2929
border-bottom-left-radius: ${get('radii.2')};
3030
}
3131
32-
:last-child {
32+
:last-of-type {
3333
border-top-right-radius: ${get('radii.2')};
3434
border-bottom-right-radius: ${get('radii.2')};
3535
}

0 commit comments

Comments
 (0)
Please sign in to comment.