Skip to content

Commit

Permalink
Fix for flyout shift (elastic#142565)
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 authored and WafaaNasr committed Oct 11, 2022
1 parent 7da847e commit 1f55566
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 1f55566

Please sign in to comment.