(label, event)
| 115 | ); |
| 116 | |
| 117 | const onClick: TabListProps['onClick'] = (label, event) => { |
| 118 | const child = tabs.find((c) => c.props.label === label); |
| 119 | setActive(label as T); |
| 120 | const shouldChange = onActiveChange?.(label as T, event); |
| 121 | |
| 122 | // evaluate !== false due to backwards compatibility with implementations that return undefined |
| 123 | if (shouldChange !== false) { |
| 124 | setTimeout(() => { |
| 125 | if (shouldFocusTabOnChange && containerRef?.current) { |
| 126 | const [firstChild] = containerRef.current.children; |
| 127 | if (firstChild instanceof HTMLElement) { |
| 128 | firstChild.focus(); |
| 129 | } |
| 130 | } |
| 131 | }, 0); |
| 132 | |
| 133 | if (child?.props?.url) { |
| 134 | navigateToUrl(child.props.url); |
| 135 | } |
| 136 | } |
| 137 | }; |
| 138 | |
| 139 | const labels = useMemo(() => tabs.map((c) => c.props.label), [tabs]); |
| 140 |
no outgoing calls
no test coverage detected