Skip to content

Commit f6728b2

Browse files
committed
fix: popover issue
1 parent 3cb7422 commit f6728b2

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

src/components/composites/Popover/Popover.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,12 @@ const Popover = (
9595
bodyMounted,
9696
setBodyMounted,
9797
setHeaderMounted,
98+
isOpen,
9899
}}
99100
>
100-
{isOpen && (
101-
<FocusScope contain={trapFocus} restoreFocus autoFocus>
102-
{children}
103-
</FocusScope>
104-
)}
101+
<FocusScope contain={trapFocus} restoreFocus autoFocus>
102+
{children}
103+
</FocusScope>
105104
</PopoverContext.Provider>
106105
</Popper>
107106
</PresenceTransition>

src/components/composites/Popover/PopoverContent.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const PopoverContent = React.forwardRef(
2121
bodyMounted,
2222
bodyId,
2323
headerId,
24+
isOpen,
2425
} = React.useContext(PopoverContext);
2526
const resolvedProps = usePropsResolution('PopoverContent', props);
2627

@@ -81,6 +82,7 @@ export const PopoverContent = React.forwardRef(
8182
{...accessibilityProps}
8283
{...resolvedProps}
8384
ref={ref}
85+
isOpen={isOpen}
8486
>
8587
{arrowElement}
8688
{restChildren}

src/components/composites/Popover/PopoverContext.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ export const PopoverContext = React.createContext({
1111
setBodyMounted: (() => {}) as any,
1212
headerMounted: false,
1313
bodyMounted: false,
14+
isOpen: false,
1415
});

src/components/composites/Popper/Popper.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const Popper = (
4040
};
4141

4242
const PopperContent = React.forwardRef(
43-
({ children, style, ...rest }: IBoxProps, ref: any) => {
43+
({ children, style, ...rest }: IBoxProps & { isOpen: boolean }, ref: any) => {
4444
const {
4545
triggerRef,
4646
shouldFlip,
@@ -52,6 +52,7 @@ const PopperContent = React.forwardRef(
5252
setOverlayRef,
5353
} = usePopperContext('PopperContent');
5454
const overlayRef = React.useRef(null);
55+
5556
// const { top } = useSafeAreaInsets();
5657
const {
5758
overlayProps,
@@ -63,7 +64,7 @@ const PopperContent = React.forwardRef(
6364
overlayRef,
6465
shouldFlip: shouldFlip,
6566
crossOffset: crossOffset,
66-
isOpen: true,
67+
isOpen: rest.isOpen,
6768
offset: offset,
6869
placement: placementProp as any,
6970
containerPadding: 0,

0 commit comments

Comments
 (0)