From 9604f58c58ff7023e9350c49eaf6db15bfddc67b Mon Sep 17 00:00:00 2001 From: Alexandr Isaev Date: Tue, 16 Jul 2024 10:38:18 +0300 Subject: [PATCH] fix(TreeSelect): fix page gap on component focus in some cases --- 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 9da524004a..b63738e0e4 100644 --- a/src/components/TreeSelect/TreeSelect.tsx +++ b/src/components/TreeSelect/TreeSelect.tsx @@ -129,7 +129,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