Skip to content

Commit

Permalink
feat(react-kit): update Overlay feature with enableInitialFocus
Browse files Browse the repository at this point in the history
  • Loading branch information
psch300 committed Dec 12, 2024
1 parent a9c2b12 commit fc773b8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react-kit/src/core/Overlay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type Props = {
size?: ResponsiveValue<OverlaySizeType>;
ignoreOutsideClickRefs?: RefObject<HTMLElement>[];
dismissFocusRef?: RefObject<HTMLElement>;
enableInitialFocus?: boolean;
} & MaxHeightProps &
SxProp &
HTMLAttributes<HTMLElement>;
Expand All @@ -35,6 +36,7 @@ const Overlay = (
size = 'm',
ignoreOutsideClickRefs = [],
dismissFocusRef,
enableInitialFocus = true,
maxHeight = forcePixelValue(600),
...props
}: PropsWithChildren<Props>,
Expand Down Expand Up @@ -78,7 +80,7 @@ const Overlay = (
);

useEffect(() => {
if (overlayRef.current) {
if (overlayRef.current && enableInitialFocus) {
const firstItem = iterateFocusableElements(overlayRef.current).next().value;
firstItem?.focus();
}
Expand Down

0 comments on commit fc773b8

Please sign in to comment.