Dropdown: opens / closes when I click inside of the modal
See original GitHub issueBug Report
Steps
- Create
DropdownandModalcomponents. PutDropdown.Itemas trigger intoModal. - Add
ModaltoDropdownas children. - Open
Modaland click inside it several times.
Expected Result
The state of dropdown does not change.
Actual Result
Dropdown opens / closes when I click inside of the modal.
Version
0.82.5.This worked in version 0.81.3
Testcase
Version 0.81.3: https://codesandbox.io/s/vy884pkzk0 Version 0.82.5: https://codesandbox.io/s/v0225n2r20
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (5 by maintainers)
Top Results From Across the Web
Preventing dropdown from closing when close modal
Before closing your modal, do something like this: $(".dropdown"). ... 1) the dropdown is open 2) you opened the modal. Hope this helps....
Read more >Dropdownlist autoclose on open in modal popup - Telerik
Basically, when something "steals" the focus from the widget, it will close the popup immediately.
Read more >Close a FlexCard Flyout Modal from an Action - Salesforce Help
From the Flyout Type dropdown, select the type of content to display in the modal. Click into Flyout and select from the list...
Read more >Dropdown closes when clicking inside the list element - General
I´ve got a cookie-modal on my site with some buttons inside of a dropdown menu. Everything works fine, expect on mobile devises. When...
Read more >Close bug in long dropdown inside modal
I am using some dropdowns in the modal. If the dropdown list contains many items that causes the scrollbar to appear and then...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m having the same issue with a
Confirmwithin aMenu.Itemafter upgrading to semantic-ui-react 0.84.0 from 0.78.2.Triggering the confirm by clicking on the menu items opens the confirm and hides the menu. Clicking within the confirm opens the menu dropdown again.
I had a hunch that click events from the confirm were bubbling up to the
Menu.Item, so I added anonClickto myConfirmthat stops event propagation:That fixes the issue for me, but I’d rather not have to sprinkle these click handles throughout my
Confirmmodals, if I don’t have to.I am also getting this issue. Version is 0.88.2 as well.
Codesandbox: https://codesandbox.io/s/semantic-ui-react-5j0io
Repro steps:
You will notice that it is not interacting with the TextArea but instead with the Dropdown behind the modal.
Sometimes if you click multiple times in the TextArea, the issue will stop and pressing Space will interact with the TextArea correctly.
Adding this to the TextArea is a temporary fix.
Edit: My team also found that this stopPropagation doesn’t completely eliminate the bug. If the modal has other elements, such as a dropdown, another text field, button, etc., and the user interacts with any of them, the text area will have this bug again if going back to the text area.
All elements in the modal will likely need the same stopPropagation lines to avoid this behavior.