Skip to content

Commit 68909b3

Browse files
author
Tomáš Vojtášek
committed
Nav: Validate children in keyboard navigation handler
1 parent 3360fde commit 68909b3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/Nav.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ class Nav extends React.Component {
157157

158158
getNextActiveChild(offset) {
159159
const { children } = this.props;
160-
const validChildren = children.filter(
160+
const validChildren = ValidComponentChildren.filter(
161+
children,
161162
child => child.props.eventKey != null && !child.props.disabled
162163
);
163164
const { activeKey, activeHref } = this.getActiveProps();

test/NavSpec.js

+1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ describe('<Nav>', () => {
168168
NavItem 4 content
169169
</NavItem>
170170
<NavItem eventKey={5}>NavItem 5 content</NavItem>
171+
{false && <NavItem eventKey={6}>NavItem 6 content</NavItem>}
171172
</Nav>,
172173
{ attachTo: mountPoint }
173174
);

0 commit comments

Comments
 (0)