(e: ReactKeyboardEvent)
| 291 | }; |
| 292 | |
| 293 | let onKeyDown = (e: ReactKeyboardEvent) => { |
| 294 | let activeElement = getActiveElement(); |
| 295 | if ( |
| 296 | !nodeContains(e.currentTarget, getEventTarget(e) as Element) || |
| 297 | !ref.current || |
| 298 | !activeElement |
| 299 | ) { |
| 300 | return; |
| 301 | } |
| 302 | |
| 303 | if (keyboardNavigationBehavior === 'tab') { |
| 304 | // Stop propagation for all events that originate from the children of the gridlist item since we don't want to trigger |
| 305 | // grid level interactions (row navigation/typeselect/etc) |
| 306 | // exception made for Tab since that needs to propagate to useSelectableCollection to tab out of the gridlist, might be others? |
| 307 | if (getEventTarget(e) !== ref.current && e.key !== 'Tab') { |
| 308 | e.stopPropagation(); |
| 309 | return; |
| 310 | } |
| 311 | |
| 312 | if ( |
| 313 | handleTreeExpansionKeys(e, state, node, hasChildRows, direction, activeElement, ref.current) |
| 314 | ) { |
| 315 | return; |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | switch (e.key) { |
| 320 | case 'Tab': { |
| 321 | if (keyboardNavigationBehavior === 'tab') { |
| 322 | // If there is another focusable element within this item, stop propagation so the tab key |
| 323 | // is handled by the browser and not by useSelectableCollection (which would take us out of the list). |
| 324 | let walker = getFocusableTreeWalker(ref.current, {tabbable: true}); |
| 325 | walker.currentNode = activeElement; |
| 326 | let next = e.shiftKey ? walker.previousNode() : walker.nextNode(); |
| 327 | |
| 328 | if (next) { |
| 329 | e.stopPropagation(); |
| 330 | } |
| 331 | } |
| 332 | } |
| 333 | } |
| 334 | }; |
| 335 | |
| 336 | let syntheticLinkProps = useSyntheticLinkProps(node.props); |
| 337 | let linkProps = itemStates.hasAction ? syntheticLinkProps : {}; |
no test coverage detected