tjwebb / react-bootstrap-select

A custom select for react-bootstrap using button dropdown

Home Page:https://www.npmjs.com/package/react-bootstrap-select

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Options remain open while clicking other selects

huuuda-aus opened this issue · comments

I'm not sure why it happened in my project - the dropdown behaviour has been logical and straightforward and peachy and all - until I did the following:

  • click the select (button)
  • the list of options will be shown
  • click another select
  • the list of this select's options will be shown BUT the previous list will not be closed

I ended up with 6 opened dropdowns until I picked an option or clicked somewhere else.

Found out you just need to comment out the e.stopPropagation() in the button click handler:

    button.click(function (e) {
      e.stopPropagation();
      self.setState({ open: !self.state.open });
    });

which will close all potential opened dropdowns before opening the clicked one.

Apologies for my clumsy explanation. I hope you get what I mean :)