Skip to content

Commit

Permalink
Bug fix: ButtonGroup hover causes wiggly buttons (#2933)
Browse files Browse the repository at this point in the history
* remove border size state changes

* snaps

* Create .changeset/cuddly-cycles-refuse.md
  • Loading branch information
langermank authored Feb 24, 2023
1 parent 533f0b4 commit 81ed540
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .changeset/cuddly-cycles-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

Bug fix: ButtonGroup hover state causes buttons to shift horizontally
9 changes: 0 additions & 9 deletions src/ButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ const ButtonGroup = styled.div`
border-bottom-right-radius: ${get('radii.2')};
}
:focus,
:active,
:hover {
border-right-width: 1px;
+ * {
border-left-width: 0;
}
}
:focus,
:active {
z-index: 1;
Expand Down
12 changes: 0 additions & 12 deletions src/__tests__/deprecated/__snapshots__/Button.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -315,18 +315,6 @@ exports[`ButtonGroup renders consistently 1`] = `
border-bottom-right-radius: 6px;
}
.c0.c0 > *:focus,
.c0.c0 > *:active,
.c0.c0 > *:hover {
border-right-width: 1px;
}
.c0.c0 > *:focus + *,
.c0.c0 > *:active + *,
.c0.c0 > *:hover + * {
border-left-width: 0;
}
.c0.c0 > *:focus,
.c0.c0 > *:active {
z-index: 1;
Expand Down
10 changes: 9 additions & 1 deletion src/stories/ButtonGroup.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react'
import {Story, Meta} from '@storybook/react'
import ButtonGroup from '../ButtonGroup'
import {Button, ButtonProps} from '../Button'
import {Button, ButtonProps, IconButton} from '../Button'
import {PlusIcon, DashIcon} from '@primer/octicons-react'

export default {
title: 'Components/ButtonGroup',
Expand Down Expand Up @@ -47,3 +48,10 @@ Playground.argTypes = {
},
},
}

export const IconButtons = () => (
<ButtonGroup>
<IconButton icon={PlusIcon} aria-label="Add" />
<IconButton icon={DashIcon} aria-label="Subtract" />
</ButtonGroup>
)

0 comments on commit 81ed540

Please sign in to comment.