react-component / select

React Select
https://select.react-component.now.sh/
MIT License
892 stars 452 forks source link

fix: Select width 0px when searching #934

Closed afc163 closed 1 year ago

afc163 commented 1 year ago

close https://github.com/ant-design/ant-design/issues/27688 close https://github.com/ant-design/ant-design/issues/41530

Select 未选 item 时,此时进行搜,placeholder 会用 visibility: hidden 的方式隐藏,但是元素还在,承担了占位的作用。

Select 选了 item 后,原先的逻辑是 placeholder 元素直接 return null,因此没有占位了,整个 input 缩为 0px

这里的逻辑改为:都使用 visibility: hidden 的方式隐藏 placeholder。当 Select 选了 item 后,placeholder 隐藏但文本内容改为 item 内容用于宽度占位。这样搜索时宽度不会变。

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
select ❌ Failed (Inspect) Apr 4, 2023 0:25am
afc163 commented 1 year ago

还得改改:https://github.com/ant-design/ant-design/pull/41646