From 640f7f348724daff8be4276bb3184d44a2e1199a Mon Sep 17 00:00:00 2001 From: nova1751 Date: Sun, 4 Feb 2024 13:39:27 +0800 Subject: [PATCH] fix: multi-select input editable problem (#1024) --- src/Selector/MultipleSelector.tsx | 4 +--- tests/Multiple.test.tsx | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Selector/MultipleSelector.tsx b/src/Selector/MultipleSelector.tsx index 8ad89025..68ac1639 100644 --- a/src/Selector/MultipleSelector.tsx +++ b/src/Selector/MultipleSelector.tsx @@ -86,9 +86,7 @@ const SelectSelector: React.FC = (props) => { ? searchValue : ''; const inputEditable: boolean = - mode === 'tags' || - (mode === 'multiple' && autoClearSearchValue === false) || - (showSearch && (open || focused)); + mode === 'tags' || (mode === 'multiple' && showSearch) || (showSearch && (open || focused)); // We measure width and set to the input immediately useLayoutEffect(() => { diff --git a/tests/Multiple.test.tsx b/tests/Multiple.test.tsx index 6e6a051a..7897090f 100644 --- a/tests/Multiple.test.tsx +++ b/tests/Multiple.test.tsx @@ -681,5 +681,16 @@ describe('Select.Multiple', () => { toggleOpen(wrapper); expect(wrapper.find('input').props().value).toBe(''); }); + it('input should be readonly when autoClearSearchValue and showSearch are both false', () => { + const wrapper = mount( +