Skip to content

Commit 88f0a5c

Browse files
committed
fix divider bug
1 parent 7fd4d39 commit 88f0a5c

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

docs/src/stories/components/ActionList/ActionListExamples.stories.jsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -949,11 +949,16 @@ MenuContextMenu.args = {
949949
showDividers: false,
950950
children: (
951951
<>
952-
<ListItemTemplate onClick={() => alert('Hello!')} text="Copy link" trailingVisual={`⌘⇧C`} />
953-
<ListItemTemplate onClick={() => alert('Hello!')} text="Quote reply" trailingVisual={`⌘⇧R`} />
954-
<ListItemTemplate onClick={() => alert('Hello!')} text="Edit comment" />
955-
<DividerTemplate />
956-
<ListItemTemplate onClick={() => alert('Hello!')} text="Delete comment" variant="ActionList-item--danger" />
952+
<ListItemTemplate onClick={() => alert('Hello!')} text="Copy link" trailingVisual={`⌘⇧C`} menuItem />
953+
<ListItemTemplate onClick={() => alert('Hello!')} text="Quote reply" trailingVisual={`⌘⇧R`} menuItem />
954+
<ListItemTemplate onClick={() => alert('Hello!')} text="Edit comment" menuItem />
955+
<DividerTemplate menuItem />
956+
<ListItemTemplate
957+
onClick={() => alert('Hello!')}
958+
text="Delete comment"
959+
variant="ActionList-item--danger"
960+
menuItem
961+
/>
957962
</>
958963
)
959964
}

docs/src/stories/components/ActionList/ActionListItem.stories.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ export const ListItemTemplate = ({
281281
fontSize,
282282
treeitem,
283283
ariaSetSize,
284-
ariaPosInset
284+
ariaPosInset,
285+
menuItem
285286
}) => {
286287
const [isCollapsed, itemIsCollapsed] = useToggle()
287288
const [isChecked, itemIsChecked] = useToggle()
@@ -301,7 +302,7 @@ export const ListItemTemplate = ({
301302
aria-level={ariaLevel ? `${ariaLevel}` : undefined}
302303
aria-setsize={ariaSetSize ? `${ariaSetSize}` : undefined}
303304
aria-posinset={ariaPosInset ? `${ariaPosInset}` : undefined}
304-
style={itemStyle}
305+
style={ariaLevel && itemStyle}
305306
onClick={collapsible || collapsibleLeading ? itemIsCollapsed : itemIsChecked}
306307
role={
307308
singleSelect
@@ -316,6 +317,8 @@ export const ListItemTemplate = ({
316317
? 'none'
317318
: treeitem
318319
? 'treeitem'
320+
: menuItem
321+
? 'menuitem'
319322
: undefined
320323
}
321324
id={id}
@@ -409,8 +412,8 @@ export const ListItemTemplate = ({
409412
<span className={clsx('ActionList-item-descriptionWrap', `${descriptionVariant}`)}>
410413
<span className={clsx('ActionList-item-label', truncateItem && 'ActionList-item-label--truncate')}>
411414
{text}
415+
<span className="ActionList-item-description">{description}</span>
412416
</span>
413-
<span className="ActionList-item-description">{description}</span>
414417
</span>
415418
)}
416419
{!description && text && (
@@ -525,8 +528,9 @@ export const ListItemTemplate = ({
525528
<span className={clsx('ActionList-item-descriptionWrap', `${descriptionVariant}`)}>
526529
<span className={clsx('ActionList-item-label', truncateItem && 'ActionList-item-label--truncate')}>
527530
{text}
531+
532+
<span className="ActionList-item-description">{description}</span>
528533
</span>
529-
<span className="ActionList-item-description">{description}</span>
530534
</span>
531535
)}
532536
{!description && text && (

src/actionlist/action-list-item.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,7 @@
285285
.ActionList-item-multiSelectCheckmark {
286286
visibility: hidden;
287287
opacity: 0;
288-
transition:
289-
visibility 0 linear $actionList-item-checkmark-transition-timing,
288+
transition: visibility 0 linear $actionList-item-checkmark-transition-timing,
290289
opacity $actionList-item-checkmark-transition-timing;
291290
}
292291

@@ -495,6 +494,11 @@
495494
// stylelint-disable-next-line primer/spacing
496495
margin-left: $actionList-item-padding-horizontal;
497496
}
497+
498+
// label wraps description to handle list dividers
499+
.ActionList-item-label {
500+
flex: 1 0 auto;
501+
}
498502
}
499503

500504
// description

0 commit comments

Comments
 (0)