Skip to content

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

Description

@PrathameshSurve
No description provided.

Activity

  1. sebastian-aranda commented on Jan 7, 2025

    @sebastian-aranda

    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 make the disabled prop true as well. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions