Skip to content

Commit 1393563

Browse files
committed
fix: avoid window scrolling to the top when treeSelect input first focus
1 parent 983318b commit 1393563

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)