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

[Feature] Allow Dropdown to Remain Open for multi==True #2821

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

TillerBurr
Copy link
Contributor

Closes #2669 (and #2820, a duplicate). This PR adds the ability to set the prop close_on_select. If multi is True and this prop is False, the menu selection remains open. If this new prop is True, it is the same behavior. The close_on_select prop has no effect when multi is False, it well essentially ignore the value. I did it that way, as I don't see the value changing after the component is created, similar to multi.

This PR will probably have a need to update the dash docs for the dropdown.

Contributor Checklist

  • I have broken down my PR scope into the following TODO tasks
    • Add the prop close_on_select to the dropdown component
    • Add tests
  • I have run the tests locally and they passed. (refer to testing section in contributing)
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR

optionals

  • I have added entry in the CHANGELOG.md
  • If this PR needs a follow-up in dash docs, community thread, I have mentioned the relevant URLS as follows
    • this GitHub #PR number updates the dash docs
    • here is the show and tell thread in Plotly Dash community

@TillerBurr
Copy link
Contributor Author

On second thought, it would make more sense to not write over the close_on_select prop. If someone were to change multi, the prop would be lost and it would always close.

@@ -155,6 +157,7 @@ const Dropdown = props => {
filterOptions={filterOptions}
options={sanitizedOptions}
value={value}
closeOnSelect={multi ? close_on_select : true}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, it would make more sense to not write over the close_on_select prop. If someone were to change multi, the prop would be lost and it would always close.

👍

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

Successfully merging this pull request may close these issues.

[Feature Request] Add option not to close dcc.Dropdown when multi=True
2 participants