Skip to content

Commit f493a15

Browse files
authored
fix: Allow falsy eventKeys in DropdownItem and ListGroupItem (react-bootstrap#5404)
1 parent 79447a7 commit f493a15

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/DropdownItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ const DropdownItem: DropdownItem = React.forwardRef(
9595
const navContext = useContext(NavContext);
9696

9797
const { activeKey } = navContext || {};
98-
const key = makeEventKey(eventKey || null, href);
98+
// TODO: Restrict eventKey to string in v5?
99+
const key = makeEventKey(eventKey as any, href);
99100

100101
const active =
101102
propActive == null && key != null

src/ListGroupItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ const ListGroupItem: ListGroupItem = React.forwardRef(
102102
<AbstractNavItem
103103
ref={ref}
104104
{...props}
105-
eventKey={makeEventKey(eventKey || null, props.href)}
105+
// TODO: Restrict eventKey to string in v5?
106+
eventKey={makeEventKey(eventKey as any, props.href)}
106107
// eslint-disable-next-line no-nested-ternary
107108
as={as || (action ? (props.href ? 'a' : 'button') : 'div')}
108109
onClick={handleClick}

0 commit comments

Comments
 (0)