Skip to content

Commit 81ed540

Browse files
authored
Bug fix: ButtonGroup hover causes wiggly buttons (#2933)
* remove border size state changes * snaps * Create .changeset/cuddly-cycles-refuse.md
1 parent 533f0b4 commit 81ed540

File tree

4 files changed

+14
-22
lines changed

4 files changed

+14
-22
lines changed

.changeset/cuddly-cycles-refuse.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+
Bug fix: ButtonGroup hover state causes buttons to shift horizontally

src/ButtonGroup.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ const ButtonGroup = styled.div`
3030
border-bottom-right-radius: ${get('radii.2')};
3131
}
3232
33-
:focus,
34-
:active,
35-
:hover {
36-
border-right-width: 1px;
37-
+ * {
38-
border-left-width: 0;
39-
}
40-
}
41-
4233
:focus,
4334
:active {
4435
z-index: 1;

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -315,18 +315,6 @@ exports[`ButtonGroup renders consistently 1`] = `
315315
border-bottom-right-radius: 6px;
316316
}
317317
318-
.c0.c0 > *:focus,
319-
.c0.c0 > *:active,
320-
.c0.c0 > *:hover {
321-
border-right-width: 1px;
322-
}
323-
324-
.c0.c0 > *:focus + *,
325-
.c0.c0 > *:active + *,
326-
.c0.c0 > *:hover + * {
327-
border-left-width: 0;
328-
}
329-
330318
.c0.c0 > *:focus,
331319
.c0.c0 > *:active {
332320
z-index: 1;

src/stories/ButtonGroup.stories.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from 'react'
22
import {Story, Meta} from '@storybook/react'
33
import ButtonGroup from '../ButtonGroup'
4-
import {Button, ButtonProps} from '../Button'
4+
import {Button, ButtonProps, IconButton} from '../Button'
5+
import {PlusIcon, DashIcon} from '@primer/octicons-react'
56

67
export default {
78
title: 'Components/ButtonGroup',
@@ -47,3 +48,10 @@ Playground.argTypes = {
4748
},
4849
},
4950
}
51+
52+
export const IconButtons = () => (
53+
<ButtonGroup>
54+
<IconButton icon={PlusIcon} aria-label="Add" />
55+
<IconButton icon={DashIcon} aria-label="Subtract" />
56+
</ButtonGroup>
57+
)

0 commit comments

Comments
 (0)