When click the dropdown arrow in Modal's Form element, such as the Select's dropdown icon, the Modal closed
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Version
3.9.2
Environment
macOS 10.13.6 Chrome(Version 68.0.3440.106 (Official Build) (64-bit)), Sarari(Version 12.0 (13606.2.11))
Reproduction link
Steps to reproduce
- click the Top Up button
- click the Search Input and then show the SearchTable
- click
Add
to show the Add Customer Modal - click the Gender Select’s dropdown arrow
- the Add Customer Modal is closed
What is expected?
show the gender select options, not close the Modal
What is actually happening?
the Modal is closed
Remark
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
How To Make a Modal Box With CSS and JavaScript
A modal is a dialog box/popup window that is displayed on top of the current page: Open Modal ... Get the <span> element...
Read more >JavaScript - Bootstrap
Bootstrap provides custom events for most plugins' unique actions. Generally, these come in an infinitive and past participle form - where the infinitive...
Read more >How to keep focus within modal dialog? - Stack Overflow
Eligible elements being checked are all visible input controls whose HTML may be input,select,textarea,button . $(document).on('keydown', ...
Read more >lightning-modal - documentation - Salesforce Developers
Create a modal component in response to a user action, such as clicking a button ... On close, the modal must save the...
Read more >Dropdown | Select2 - The jQuery replacement for select boxes
on('shown.bs.modal', '.modal', function() { $(this).find ...
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 FreeTop 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
Top GitHub Comments
rc-select
has the logic on arrow click whichstopPropagation
the click event. This is OK in react life cycle.But this demo code use
addEventListener
indocument
. Check your code onsearchTable.js
:Since in react, the
handleContainerClick
isstopPropagation
by arrow click which is not trigger. The document only get thehandleListenClick
trigger makes the popup hide.It’s little tricky to use this code since react currently addEventListener on document (But maybe not in future). The addEventListener in your code is the second listener with document so you can
stopImmediatePropagation
to prevent what you added listener in thecomponentDidMount
. Also this code has another potential risk like some code really want to handle document click. The better way is move the modal out of SearchTable which only provide the Add button but use some prop function likeonAddCustomer
to handle this.Thanks, it’s a way to solve this issues temporary, by overriding the style of
Select
inantd