We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7a961de commit caba744Copy full SHA for caba744
1 file changed
packages/@primereact/headless/src/popover/usePopover.ts
@@ -56,10 +56,19 @@ export const usePopover = withHeadless({
56
const setAnchorFallbackRef = React.useCallback((node: HTMLElement | null) => {
57
const element = toElement(node) ?? null;
58
59
- if (!element || element === anchorFallbackRef.current) return;
+ if (element === anchorFallbackRef.current) return;
60
61
anchorFallbackRef.current = element;
62
63
+ if (!element) {
64
+ if (anchorRef.current && !anchorRef.current.isConnected) {
65
+ anchorRef.current = null;
66
+ setAnchorElement(null);
67
+ }
68
+
69
+ return;
70
71
72
if (!anchorRef.current) {
73
anchorRef.current = element;
74
setAnchorElement(element);
0 commit comments