Skip to content

Commit

Permalink
Typescript lint workaround
Browse files Browse the repository at this point in the history
- my local vscode doesn't complain about this, but CLI does - not totally sure why or if this makes sense :|
  • Loading branch information
cee-chen committed Jan 4, 2024
1 parent 3a02082 commit c767730
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/datagrid/body/cell/focus_utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import React, {
FunctionComponent,
useEffect,
useState,
useMemo,
} from 'react';
import { tabbable } from 'tabbable';

Expand Down Expand Up @@ -58,9 +59,10 @@ export const HandleInteractiveChildren: FunctionComponent<
}
}, [cellEl, updateCellFocusContext]);

if (!cellEl) return children; // Do nothing if cell has yet to mount or is unmounting
if (!renderFocusTrap) return children; // Cells with default actions / expansion popovers do not need to trap
if (!hasInteractiveChildren) return children; // No need to focus trap if no children are interactive
const _children = useMemo(() => <>{children}</>, [children]);
if (!cellEl) return _children; // Do nothing if cell has yet to mount or is unmounting
if (!renderFocusTrap) return _children; // Cells with default actions / expansion popovers do not need to trap
if (!hasInteractiveChildren) return _children; // No need to focus trap if no children are interactive

return (
<FocusTrappedChildren cellEl={cellEl}>{children}</FocusTrappedChildren>
Expand Down

0 comments on commit c767730

Please sign in to comment.