Skip to content

Commit

Permalink
fix(ActionList): update to read from group context if selectionVarian…
Browse files Browse the repository at this point in the history
…t is defined (#3269)

Co-authored-by: Josh Black <joshblack@users.noreply.github.com>
  • Loading branch information
joshblack and joshblack authored May 9, 2023
1 parent 332a1af commit 21ec626
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ActionList/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<SxProp>(sx)

Expand All @@ -39,8 +40,11 @@ export const Item = React.forwardRef<HTMLLIElement, ActionListItemProps>(
})
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']
Expand Down

0 comments on commit 21ec626

Please sign in to comment.