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

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

@TillerBurr TillerBurr commented Mar 29, 2024

Closes #2820 (and #2669, an earlier report of the same issue). 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.

👍

@WWakker
Copy link

WWakker commented Jun 12, 2024

@T4rk1n I’m willing to help out for this request. Is there something that still needs to be done? Probably the docs need to be updated for the new parameter but this doesn’t seem to be open source

@T4rk1n
Copy link
Contributor

T4rk1n commented Jun 12, 2024

@WWakker Just need to change this: closeOnSelect={multi ? close_on_select : true} for something that is more user friendly. Either we can set the close_on_select default prop to true or invert the prop condition name to something like stay_open and give closeOnSelect(!stay_open}. I think the first option is closer to the wrapped dropdown api so might be better.

@WWakker
Copy link

WWakker commented Jul 21, 2024

@T4rk1n I think this is already addressed by bc1d0d2. The default close_on_select prop is true, and it can only by false if multi is true which I believe is the desired behavior?

@gvwilson gvwilson self-assigned this Jul 25, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson changed the title [Feature] Allow Dropdown to Remain Open for multi==True Allow Dropdown to Remain Open for multi==True Aug 13, 2024
@gvwilson gvwilson added feature something new P2 considered for next cycle community community contribution labels Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community community contribution feature something new P2 considered for next cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow dcc.Dropdown with multi=True to stay open when item is selected
5 participants