Skip to content

Commit 71859ed

Browse files
authored
ActionList: Ensure variant is respected when full (#4706)
* Fix `variant` issue when `full` and FF is enabled * Adjust width styles for FF * Add changeset * Add full variant vrt tests
1 parent 89c3a08 commit 71859ed

13 files changed

+45
-2
lines changed

.changeset/famous-zebras-train.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+
(Behind feature flag) ActionList: Fix for "full" variant when using button semantics

e2e/components/ActionList.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,4 +654,32 @@ test.describe('ActionList', () => {
654654
})
655655
}
656656
})
657+
658+
test.describe('Full Variant', () => {
659+
for (const theme of themes) {
660+
test.describe(theme, () => {
661+
test('default @vrt', async ({page}) => {
662+
await visit(page, {
663+
id: 'components-actionlist-features--full-variant',
664+
globals: {
665+
colorScheme: theme,
666+
},
667+
})
668+
669+
// Default state
670+
expect(await page.screenshot()).toMatchSnapshot(`ActionList.Full Variant.${theme}.png`)
671+
})
672+
673+
test('axe @aat', async ({page}) => {
674+
await visit(page, {
675+
id: 'components-actionlist-features--full-variant',
676+
globals: {
677+
colorScheme: theme,
678+
},
679+
})
680+
await expect(page).toHaveNoViolations()
681+
})
682+
})
683+
}
684+
})
657685
})

packages/react/src/ActionList/ActionList.features.stories.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,3 +792,13 @@ export const WithTrailingAction = () => {
792792
</FeatureFlags>
793793
)
794794
}
795+
796+
export const FullVariant = () => (
797+
<ActionList variant="full">
798+
<ActionList.Item>Copy link</ActionList.Item>
799+
<ActionList.Item>Quote reply</ActionList.Item>
800+
<ActionList.Item>Edit comment</ActionList.Item>
801+
<ActionList.Divider />
802+
<ActionList.Item variant="danger">Delete file</ActionList.Item>
803+
</ActionList>
804+
)

packages/react/src/ActionList/Item.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ export const Item = React.forwardRef<HTMLLIElement, ActionListItemProps>(
183183
display: 'flex',
184184
// show between 2 items
185185
':not(:first-of-type)': {'--divider-color': theme?.colors.actionListItem.inlineDivider},
186-
width: 'calc(100% - 16px)',
187-
marginX: buttonSemantics ? '2' : '0',
186+
width: buttonSemantics && listVariant !== 'full' ? 'calc(100% - 16px)' : '100%',
187+
marginX: buttonSemantics && listVariant !== 'full' ? '2' : '0',
188188
...(buttonSemantics ? hoverStyles : {}),
189189
}
190190

0 commit comments

Comments
 (0)