Skip to content

Commit 31862e1

Browse files
committed
fix: avoid page scrolling when treeSelect is first opened
1 parent 793a5ac commit 31862e1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

components/vc-tree-select/src/SearchInput.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ const SearchInput = {
7070
*/
7171
focus (isDidMount) {
7272
if (this.inputRef.current) {
73-
this.inputRef.current.focus()
7473
if (isDidMount) {
7574
setTimeout(() => {
7675
this.inputRef.current.focus()
7776
}, 0)
77+
} else { // set it into else, Avoid scrolling when focus
78+
this.inputRef.current.focus()
7879
}
7980
}
8081
},

0 commit comments

Comments
 (0)