diff --git a/components/descriptions/style/index.less b/components/descriptions/style/index.less index dae1baeb7..155468ef0 100644 --- a/components/descriptions/style/index.less +++ b/components/descriptions/style/index.less @@ -41,7 +41,6 @@ font-weight: normal; font-size: @font-size-base; line-height: @line-height-base; - white-space: nowrap; &::after { position: relative; diff --git a/components/input/ResizableTextArea.jsx b/components/input/ResizableTextArea.jsx index e4d094e3c..33714e3e7 100644 --- a/components/input/ResizableTextArea.jsx +++ b/components/input/ResizableTextArea.jsx @@ -55,9 +55,24 @@ const ResizableTextArea = { raf.cancel(this.resizeFrameId); this.resizeFrameId = raf(() => { this.setState({ resizing: false }); + this.fixFirefoxAutoScroll(); }); }); }, + // https://github.com/ant-design/ant-design/issues/21870 + fixFirefoxAutoScroll() { + try { + if (document.activeElement === this.$refs.textArea) { + const currentStart = this.$refs.textArea.selectionStart; + const currentEnd = this.$refs.textArea.selectionEnd; + this.$refs.textArea.setSelectionRange(currentStart, currentEnd); + } + } catch (e) { + // Fix error in Chrome: + // Failed to read the 'selectionStart' property from 'HTMLInputElement' + // http://stackoverflow.com/q/21177489/3040605 + } + }, renderTextArea() { const props = getOptionProps(this); @@ -89,7 +104,7 @@ const ResizableTextArea = { } const style = { ...textareaStyles, - ...(resizing ? { overflow: 'hidden' } : null), + ...(resizing ? { overflowX: 'hidden', overflowY: 'hidden' } : null), }; const textareaProps = { attrs: otherProps, diff --git a/components/input/__tests__/__snapshots__/demo.test.js.snap b/components/input/__tests__/__snapshots__/demo.test.js.snap index d1abe25a6..dd5d8df47 100644 --- a/components/input/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input/__tests__/__snapshots__/demo.test.js.snap @@ -13,9 +13,9 @@ exports[`renders ./antdv-demo/docs/input/demo/addon.md correctly 1`] = ` exports[`renders ./antdv-demo/docs/input/demo/allowClear.md correctly 1`] = `