From cd4eb93375ad7a6cfc6e4c87a92e3a20679b3047 Mon Sep 17 00:00:00 2001 From: Isaev Alexandr Date: Tue, 16 Jul 2024 16:21:55 +0300 Subject: [PATCH] fix(TreeSelect): fix page gap on component focus in some cases (#1708) --- src/components/TreeSelect/TreeSelect.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/TreeSelect/TreeSelect.tsx b/src/components/TreeSelect/TreeSelect.tsx index 8a9d08b472..73084f2ebd 100644 --- a/src/components/TreeSelect/TreeSelect.tsx +++ b/src/components/TreeSelect/TreeSelect.tsx @@ -130,7 +130,8 @@ export const TreeSelect = React.forwardRef(function TreeSelect( // restoring focus when popup opens React.useLayoutEffect(() => { if (open) { - containerRef.current?.focus(); + // for some reason popup position on page may be wrong calculated. `preventScroll` prevent page gap in that cases + containerRef.current?.focus({preventScroll: true}); } return () => list.state.setActiveItemId(undefined); // reset active item on popup close