question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using a TreeSelect on top of Modal, the window is closed when selecting a value

See original GitHub issue

What 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:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
asudohcommented, Jan 24, 2020

Seems that the CodeSandbox example uses a 3rd-party floating menu. From that:

  1. <Modal> has selectorsFloatingMenus 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 your node_modules/carbon-components-react.
  2. Given the 3rd-party component nature, we cannot guarantee the integration works well out-of-the-box, such as, z-index coordination
  3. Also given the 3rd-party component nature, it drifts away from Carbon design ecosystem. In case you haven’t, I recommend you work with your designer to see a design that fits in Carbon design ecosystem for your feature. It may yield usage of combination of existing Carbon components (with existing feature set)
0reactions
zbeedatmcommented, Jan 24, 2020

It 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:

  1. the need foe customizing the z-index
  2. customizing the close event

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found