diff --git a/src/input/base.jsx b/src/input/base.jsx index f8949ac85b..f2644bb557 100644 --- a/src/input/base.jsx +++ b/src/input/base.jsx @@ -320,8 +320,8 @@ class Base extends React.Component { return this.inputRef; } - focus(start, end) { - this.inputRef.focus(); + focus(start, end, preventScroll = false) { + this.inputRef.focus({ preventScroll }); if (typeof start === 'number') { this.inputRef.selectionStart = start; } diff --git a/src/select/base.jsx b/src/select/base.jsx index 24e6b13399..39a37a4e4b 100644 --- a/src/select/base.jsx +++ b/src/select/base.jsx @@ -590,7 +590,7 @@ export default class Base extends React.Component { * @override */ focusInput() { - this.inputRef.focus(); + this.inputRef.focus(undefined, undefined, true); } focus(...args) { diff --git a/test/select/index-spec.js b/test/select/index-spec.js index dd6af5777c..bba9c74401 100644 --- a/test/select/index-spec.js +++ b/test/select/index-spec.js @@ -1289,6 +1289,23 @@ describe('AutoComplete', () => { }, 200); }); + it('should prevent scroll when click wrapper', async () => { + wrapper = mount( +