MCPcopy
hub / github.com/reactjs/react-tabs / isTabFromContainer

Function isTabFromContainer

src/components/UncontrolledTabs.jsx:358–374  ·  view source on GitHub ↗

* Determine if a node from event.target is a Tab element for the current Tabs container. * If the clicked element is not a Tab, it returns false. * If it finds another Tabs container between the Tab and `this`, it returns false.

(node)

Source from the content-addressed store, hash-verified

356 * If it finds another Tabs container between the Tab and `this`, it returns false.
357 */
358 function isTabFromContainer(node) {
359 // return immediately if the clicked element is not a Tab.
360 if (!isTabNode(node)) {
361 return false;
362 }
363
364 // Check if the first occurrence of a Tabs container is `this` one.
365 let nodeAncestor = node.parentElement;
366 do {
367 if (nodeAncestor === ref.current) return true;
368 if (nodeAncestor.getAttribute('data-rttabs')) break;
369
370 nodeAncestor = nodeAncestor.parentElement;
371 } while (nodeAncestor);
372
373 return false;
374 }
375 const {
376 children, // unused
377 className,

Callers 2

handleKeyDownFunction · 0.85
handleClickFunction · 0.85

Calls 1

isTabNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…