diff --git a/components/input/__tests__/__snapshots__/demo.test.js.snap b/components/input/__tests__/__snapshots__/demo.test.js.snap index 508568e1c4..bfd0baebab 100644 --- a/components/input/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input/__tests__/__snapshots__/demo.test.js.snap @@ -983,67 +983,90 @@ exports[`renders ./components/input/demo/password-input.md correctly 1`] = ` `; exports[`renders ./components/input/demo/presuffix.md correctly 1`] = ` - +
- - - + + + + + + + + + - +
+
- - - + ¥ + + + + RMB + - +
`; exports[`renders ./components/input/demo/search-input.md correctly 1`] = ` diff --git a/components/input/demo/presuffix.md b/components/input/demo/presuffix.md index 59fcc00e84..06ed0b755b 100644 --- a/components/input/demo/presuffix.md +++ b/components/input/demo/presuffix.md @@ -17,15 +17,22 @@ Add prefix or suffix icons inside input. import { Input, Tooltip, Icon } from 'antd'; ReactDOM.render( - } - suffix={ - - - - } - />, +
+ } + suffix={ + + + + } + /> + +
+
+ + +
, mountNode, ); ``` diff --git a/components/input/style/mixin.less b/components/input/style/mixin.less index 827a8bfc52..9aedbab4c9 100644 --- a/components/input/style/mixin.less +++ b/components/input/style/mixin.less @@ -369,25 +369,23 @@ text-align: inherit; } + // Should not break align of icon & text + // https://github.com/ant-design/ant-design/issues/18087 + // https://github.com/ant-design/ant-design/issues/17414 + // https://github.com/ant-design/ant-design/pull/17684 + // https://codesandbox.io/embed/pensive-paper-di2wk + // https://codesandbox.io/embed/nifty-benz-gb7ml .@{inputClass}-prefix, .@{inputClass}-suffix { position: absolute; - top: 0; + top: 50%; z-index: 2; color: @input-color; line-height: 0; - height: 100%; - box-sizing: border-box; - padding: @input-padding-vertical-base + @border-width-base 0; + transform: translateY(-50%); :not(.anticon) { line-height: @line-height-base; } - .anticon { - position: relative; - vertical-align: top; - top: 50%; - transform: translateY(-50%); - } } .@{inputClass}-prefix {