-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat(Dropdown): add closeOnChange
prop
#1244
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
Comments
{boolean} closeOnSelect
, for multiple
-select dropdownscloseOnSelect
prop
I'm all for this change. Let's go with I'd think this would only close on changes invoked by user interaction, such as, click and enter. This way programmatic updates don't usurp user control. Thoughts? |
I think that fits the pattern, since changing |
closeOnSelect
propcloseOnChange
prop
@apiv Heads up, if the PR description contained Fixed in #1244, thanks for the work! |
I'm having some trouble with this. When I use a dropdown without Adding Any advice? |
Per the docs, the opening and closing are done via CSS:
My guess is that you are probably getting some kind of conflicting behavior by having CSS and JS attempt to control the open state. I would instead move to a controlled component pattern and toggle the If you post a codepen showing your issue, perhaps someone will give more details. |
Here is a pen showing the issue: The first menu uses the simple prop, and it takes 2 clicks to have the menu close upon selection. The second menu closes fine on the first click (after opening the sub-menu by clicking it). I'm just going to get rid of the simple prop in my case :) |
Oh I see, nested Dropdowns are not supported either. https://react.semantic-ui.com/modules/dropdown#dropdown-example-menu-direction |
Steps
Proposed changes
There are use cases for both menu open/close behaviors, but in some cases, I may want to close the dropdown on select. I'm proposing that we add a
closeOnChange
orcloseOnSelect
option toDropdown
, defaulting totrue
for single selects andfalse
for multi-selects.Version
v0.64.4
Testcase
http://react.semantic-ui.com/modules/dropdown#search-selection
http://react.semantic-ui.com/modules/dropdown#multiple-search-selection
I'm willing to submit a PR for this if we decide this option is worth adding to
Dropdown
.The text was updated successfully, but these errors were encountered: