From 21ec62659cce74459ab783191ab67bbaf69f23f4 Mon Sep 17 00:00:00 2001 From: Josh Black Date: Tue, 9 May 2023 17:39:08 -0500 Subject: [PATCH] fix(ActionList): update to read from group context if selectionVariant is defined (#3269) Co-authored-by: Josh Black --- src/ActionList/Item.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ActionList/Item.tsx b/src/ActionList/Item.tsx index 60126e3528a..8064ff2f1c1 100644 --- a/src/ActionList/Item.tsx +++ b/src/ActionList/Item.tsx @@ -13,6 +13,7 @@ import {ActionListProps, ListContext} from './List' import {Selection} from './Selection' import {ActionListItemProps, getVariantStyles, ItemContext, TEXT_ROW_HEIGHT} from './shared' import {LeadingVisual, TrailingVisual} from './Visuals' +import {GroupContext} from './Group' const LiBox = styled.li(sx) @@ -39,8 +40,11 @@ export const Item = React.forwardRef( }) const {variant: listVariant, showDividers, selectionVariant: listSelectionVariant} = React.useContext(ListContext) const {container, afterSelect, selectionAttribute} = React.useContext(ActionListContainerContext) + const {selectionVariant: groupSelectionVariant} = React.useContext(GroupContext) - const selectionVariant: ActionListProps['selectionVariant'] = listSelectionVariant + const selectionVariant: ActionListProps['selectionVariant'] = groupSelectionVariant + ? groupSelectionVariant + : listSelectionVariant /** Infer item role based on the container */ let itemRole: ActionListItemProps['role']