Skip to content

Commit

Permalink
fix(TreeSelect): fix page gap on component focus in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaevAlexandr committed Jul 16, 2024
1 parent 07a16c9 commit 9604f58
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/TreeSelect/TreeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export const TreeSelect = React.forwardRef(function TreeSelect<T>(
// 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
Expand Down

0 comments on commit 9604f58

Please sign in to comment.