Skip to content

Commit

Permalink
fix(TreeSelect): fix page gap on component focus in some cases (#1708)
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaevAlexandr authored Jul 16, 2024
1 parent f12d49f commit cd4eb93
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 @@ -130,7 +130,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 cd4eb93

Please sign in to comment.