ant-design / ant-design/pro-components

🐛[BUG] Request + ShowSearch + AutoClearSearchValue=false + multiple 时,SearchValue 会常显,期望移除焦点时隐藏

Open
#9,292 1 comment 0 reactions 0 assignees View on GitHub
⭕️ bug 🧱 antd
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

### 🐛 bug 描述

我的需求是:
1. 需要 Request 远端查询(数据量大) showSearch + request
2. 需要多选 mode="multiple"
3. 需要连续选择(命名有一定的规律,搜出来给这一组都选上) autoClearSearchValue: false
```tsx
options}
showSearch
fieldProps={{ autoClearSearchValue: false }}
mode="multiple"
/>
```

这个时候就会出现下面的bug,autoClearSearchValue 为 true 的话,失去焦点就会隐藏,**但是 autoClearSearchValue 为 false 的话,失去焦点就不会隐藏**

Image

Image

### 📷 复现步骤

https://codesandbox.io/p/sandbox/dawn-sound-rvqqjq?file=%2FApp.tsx%3A48%2C7-55%2C9

1. Request + ShowSearch + mode=multiple
这里输入 34,然后失去焦点,然后在获得焦点,可以发现失去焦点时34隐藏,获得焦点时 34 显示
3. Request + ShowSearch + AutoClearSearchValue=false + mode=multiple
这里输入 34,然后失去焦点,可以发现失去焦点时34还在显示

### 🏞 期望结果

期望失去焦点时 34 隐藏

### 💻 复现代码

https://codesandbox.io/p/sandbox/dawn-sound-rvqqjq?file=%2FApp.tsx%3A48%2C7-55%2C9

### © 版本信息

https://codesandbox.io/p/sandbox/dawn-sound-rvqqjq?file=%2FApp.tsx%3A48%2C7-55%2C9

"dependencies": {
"@ant-design/pro-components": "3.0.2-0",
"antd": "5.27.6",
"react": "18.3.1",
"react-dom": "18.3.1"
},

其他版本应该也有问题

### 🚑 其他信息

Contributor guide

Open the contributing guide

Research direction

Start by running the linked CodeSandbox and inspect App.tsx around lines 48–55, focusing on ProFormSelect with request, showSearch, mode="multiple", and fieldProps autoClearSearchValue=false. Compare blur behavior with the default setting and trace the ProFormSelect implementation. Done means the search value is hidden on blur in the reported configuration while remaining available again on focus and selected values are preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.