Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: multi-select input editable problem #1025

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/Selector/MultipleSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ const SelectSelector: React.FC<SelectorProps> = (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(() => {
Expand Down
11 changes: 11 additions & 0 deletions tests/Multiple.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<Select
mode="multiple"
autoClearSearchValue={false}
showSearch={false}
searchValue="test"
/>,
);
expect(wrapper.find('input').props().readOnly).toBe(true);
});
});
});
Loading