Skip to content

Commit 357d3b7

Browse files
authored
Merge pull request react-bootstrap#3350 from vojty/fix/validate-children-nav-keyboard
Nav: Validate children in keyboard navigation handler
2 parents 3360fde + 68909b3 commit 357d3b7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/Nav.js

Lines changed: 2 additions & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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)