Skip to content

Commit

Permalink
Fix for flyout shift (#142565)
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 authored Oct 5, 2022
1 parent 0ab0f7a commit 4019d37
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,20 @@ export function DimensionContainer({
}, [handleClose]);

useEffect(() => {
if (isOpen) {
document.body.classList.add('lnsBody--overflowHidden');
} else {
document.body.classList.remove('lnsBody--overflowHidden');
}
document.body.classList.toggle('lnsBody--overflowHidden', isOpen);
return () => {
if (isOpen) {
setFocusTrapIsEnabled(false);
}
document.body.classList.remove('lnsBody--overflowHidden');
};
});
}, [isOpen]);

if (!isOpen) {
return null;
}

return isOpen ? (
return (
<div ref={panelRef}>
<EuiFocusTrap
disabled={!focusTrapIsEnabled}
Expand Down Expand Up @@ -152,5 +155,5 @@ export function DimensionContainer({
</div>
</EuiFocusTrap>
</div>
) : null;
);
}

0 comments on commit 4019d37

Please sign in to comment.