select
select copied to clipboard
Improve behaviour on blur
I'm using something similar to the following code. This is one of the examples from https://ant.design/components/select/
<Select
showSearch
style={{ width: 200 }}
placeholder="Select a person"
optionFilterProp="children"
onChange={handleChange}
onFocus={handleFocus}
onBlur={handleBlur}
filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="tom">Tom</Option>
</Select>
When typing "jack" and then pressing TAB, the dropdown box briefly expands just before closing again.

This patch fixes that behaviour by setting the open state to closed just before firing the change, instead of afterwards.
Codecov Report
Merging #255 into master will increase coverage by
<.01%. The diff coverage isn/a.
@@ Coverage Diff @@
## master #255 +/- ##
==========================================
+ Coverage 98.95% 98.95% +<.01%
==========================================
Files 8 8
Lines 287 288 +1
Branches 81 82 +1
==========================================
+ Hits 284 285 +1
Misses 3 3
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/Select.jsx | 100% <ø> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update dade915...69890f4. Read the comment docs.
Thanks, I'v tried fix this behavior too, but can't reproduce it in test, can you write a test?
@rolftimmermans