Skip to content

Commit

Permalink
Move flex-shrink: 0 to BaseVisualContainer. (#1596)
Browse files Browse the repository at this point in the history
* Move `flex-shrink: 0` to `BaseVisualContainer`.
This is to address a bug where in a single-select action menu, if an item wraps, it will become misaligned with other items in the list.

* Added changeset

* Updated test snapshots
  • Loading branch information
dmarcey authored and pksjce committed Dec 19, 2021
1 parent 0a053b2 commit c8ac8a2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/grumpy-tomatoes-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/components': patch
---

Fix alignment of items in ActionList (single-select) if some of the items have wrapping text.
2 changes: 1 addition & 1 deletion src/ActionList/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ const BaseVisualContainer = styled.div<{variant?: ItemProps['variant']; disabled
display: flex;
justify-content: center;
align-items: center;
flex-shrink: 0;
`

const ColoredVisualContainer = styled(BaseVisualContainer)`
Expand All @@ -285,7 +286,6 @@ const ColoredVisualContainer = styled(BaseVisualContainer)`
`

const LeadingVisualContainer = styled(ColoredVisualContainer)`
flex-shrink: 0;
display: flex;
flex-direction: column;
justify-content: center;
Expand Down
9 changes: 9 additions & 0 deletions src/__tests__/__snapshots__/Autocomplete.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ Array [
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
}
.c10 {
Expand Down Expand Up @@ -1375,6 +1378,9 @@ Array [
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
}
.c6 rect {
Expand Down Expand Up @@ -2192,6 +2198,9 @@ Array [
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
}
.c10 rect {
Expand Down

0 comments on commit c8ac8a2

Please sign in to comment.