Using a TreeSelect on top of Modal, the window is closed when selecting a value
See original GitHub issueWhat package(s) are you using?
-
carbon-components
-
carbon-components-react
Summary
I’m trying to use a TreeSelect component (nested drop down) on top of a Modal. Tried using 2 components: one is from antd and the second from rsuite.
In both I had to change the style of the dropdown values list and update the z-index to very high value (10000) in order to get the dropdown values shown on top of the Modal. (I guess because in carbon css the Modal is using a high z-index value to keep it on top)
But in both I’m facing an issue with the Modal getting closed when choosing an element from the ddl !!!
I tried using the e.preventDefault() / e.persist() but with no luck.
Relevant information
To reproduce it: https://codesandbox.io/s/antd-reproduction-template-ci559
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
css - TreeSelect is hidden behind when using it in a Modal ...
I tried using the Ant Design TreeSelect component withing a Modal, but when opening that TreeSelect the values of the tree is hidden...
Read more >Modal - Angular powered Bootstrap
close. close(result: any) => void. Closes the modal with an optional result value. The NgbModalRef.result promise will be resolved with the provided value....
Read more >Modal | NG-ZORRO
To use NzModalService.confirm() to popup confirmation modal dialog. Let NzOnCancel/NzOnOk function return a promise object to delay closing the dialog.
Read more >Dialog | Element Plus
Set model-value / v-model attribute with a Boolean , and Dialog shows when ... TIP. before-close only works when user clicks the close...
Read more >Modal | U.S. Web Design System (USWDS)
A modal prevents interaction with page content until the user completes an ... CSS will display .usa-modal__close at the top right of the...
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
Seems that the CodeSandbox example uses a 3rd-party floating menu. From that:
<Modal>
hasselectorsFloatingMenus
prop so your app can tell<Modal>
that there are additional floating menus used in your app. You can debug code corresponding to https://github.com/carbon-design-system/carbon/blob/v10.9.0/packages/react/src/components/Modal/Modal.js#L181-L192 in yournode_modules/carbon-components-react
.z-index
coordinationIt can be done, but need to check what is the target from the close event and just if it’s comming from the drop down to prevent it.
But what I’m saying, that both issues:
are not needed when using other Modal of other libraries, so maybe there is a place to make it working out of the box without any customization… if not, simply will live wit it.