-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Dropdown menu only closes when it loses focus if the parent dropdown has been clicked #2447
Comments
Hello @mtg5014. Your code sandbox is working as expected. Dropdown state is not fully managed when you are using the subcomponent API, which you are using in your example. I made another codepen using the shorthand API in which the state is fully managed: https://codesandbox.io/s/y014qkmy3x You'll notice a few tweaks I had to make with the |
Hi @brianespinosa , and thanks for the quick response. I am trying to render each DropdownItem with as={Link}, where Link is from react-router-dom (4.2.2). I tried using options as follows: While I didn't suspect that would work, it did resolve this particular issue. However, it leads to strange behavior with regards to the selected item. I suspect you don't need to see a codepen of that, but let me know if so. I don't see an obvious function I can call to open/close the dropdown/items if I use the subcomponent API. Do you have a recommendation? |
@mtg5014 Just for clarity sake, your follow-up where you reference passing
To answer this, if you are using the subcomponent API, the Another thing you might want to consider if you want to set an active class... you are using |
Thanks again @brianespinosa. I ended up managing the active prop using the subcomponent API, and that worked fine. I just needed to set active={false} onMouseLeave of the items. I did not know that NavLink would play nicely with SUI styles, however. I switched over and now that works as well! |
I ve solved that keeping dropdown opened. In my case, I m calling this method into every method of flatpckr flatpickr('#startDate', {
|
Steps
Test Case 1:
Click off of the dropdown to close it between test cases.
Test Case 2:
Expected Result
Test Case 1
Dropdown should close.
Test Case 2:
Dropdown should close.
Actual Result
Test Case 1:
Dropdown stays open.
Test Case 2:
Dropdown closes.
Is this the expected behavior? I am writing a desktop app and normally the user hovers, then selects an item. With this order of events the dropdown remains open, requiring an extra click to close it, which doesn't seem correct....but maybe I've done something wrong?
Version
0.74.2
Testcase
https://codesandbox.io/s/10j450x2xl
The text was updated successfully, but these errors were encountered: