From 1f55566f841b252ba81a174d61281a2d1a0a903c Mon Sep 17 00:00:00 2001 From: Marco Liberati Date: Wed, 5 Oct 2022 12:32:56 +0200 Subject: [PATCH] Fix for flyout shift (#142565) --- .../config_panel/dimension_container.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/dimension_container.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/dimension_container.tsx index cd74119bbe31..9d71e74eff47 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/dimension_container.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/dimension_container.tsx @@ -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 (
- ) : null; + ); }