Skip to content

Commit 5bd6bfe

Browse files
Rendezdanez
authored andcommitted
feat(tabs): verify click tabNode using *[role=tab] (#220)
Implementing `react-tabs` with a custom `TabList` & `Tab` components can be currently done by using the corresponding `tabRole` static in custom components. This is neat. However, the check within `isTabNode()` relies on the tagName being an `LI` element, and this has some limitations for cases where the `tabList` markup isn't done using a `ul > li` structure.
1 parent 82e2913 commit 5bd6bfe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/UncontrolledTabs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { isTabList, isTabPanel, isTab } from '../helpers/elementTypes';
99

1010
// Determine if a node from event.target is a Tab element
1111
function isTabNode(node) {
12-
return node.nodeName === 'LI' && node.getAttribute('role') === 'tab';
12+
return node.getAttribute('role') === 'tab';
1313
}
1414

1515
// Determine if a tab node is disabled

0 commit comments

Comments
 (0)