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

Unable to open the dropdown list when clicking on the placeholder if singleSelect is set to true. #262

Open
PrathameshSurve opened this issue Aug 27, 2024 · 1 comment

Comments

@PrathameshSurve
Copy link

No description provided.

@sebastian-aranda
Copy link

sebastian-aranda commented Jan 7, 2025

I was having the same issue and this seems to be related with the search box input: https://github.com/srigar/multiselect-react-dropdown/blob/v2.0.25/src/multiselect/multiselect.component.tsx#L572. As you can see there the searchbox is always present, but when singleSelect is true it will be set always with the disabled attribute. As the search box input takes most of the space, if you click on it being disabled will result in no behavior.

My workaround was to remove the search box input programatically:

// Add id="msParent" to the parent div of the ReactMultiselect.
const msParent = document.getElementById('msParent');
const searchBox = msParent.getElementsByClassName('searchBox')[0];
searchBox.remove();

Make sure to do this on both mount and update methods.

PD: I tried removing the "disabled" attribute and adding "readonly" but the rendering behavior didn't work properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants