Skip to content
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

ComposedModal - Letting onClose called with the event object #4516

Closed
zbeedatm opened this issue Nov 1, 2019 · 8 comments · Fixed by #4622
Closed

ComposedModal - Letting onClose called with the event object #4516

zbeedatm opened this issue Nov 1, 2019 · 8 comments · Fixed by #4622

Comments

@zbeedatm
Copy link

zbeedatm commented Nov 1, 2019

Summary

Letting onClose called with the event object of ComposedModl, will allow to inspect event.target to detect if it's from click-outside or by clicking on the "x" button to close that modal.

Justification

Need to prevent closing Modal (ComposedModal in my case) when clicking with the mouse outside the popup screen.

Desired UX and success metrics

I need to prevent closing Modal (ComposedModal in my case) when clicking with the mouse outside the popup screen.

"Must have" functionality

Specific timeline issues / requests

Available extra resources

@zbeedatm
Copy link
Author

Thanks for the fix. Is it part of a new release already?

@asudoh
Copy link
Contributor

asudoh commented Nov 11, 2019

I suppose not, but stay tuned for: https://github.com/carbon-design-system/carbon/releases

@zbeedatm
Copy link
Author

Hi,
I updated to 10.7.4 (which includes #4622) and used:
onClose = { e => this.closeImportProjectModal(e)}

closeImportProjectModal(e) { if (e) { console.log(e.target) }

Currently behavior, if I press on the Cancel button of Modal footer e.target is populated.
But when pressing on the "X" button or clicking with the mouse outside, (e) event is undefined!

How can I distinguish between them? Am I missing something?

@asudoh
Copy link
Contributor

asudoh commented Nov 18, 2019

@zbeedatm
Copy link
Author

reduced in : https://codesandbox.io/s/fragrant-morning-267l5
(The import project modal)

@asudoh
Copy link
Contributor

asudoh commented Nov 19, 2019

Opening https://codesandbox.io/s/fragrant-morning-267l5, clicking Import button and clicking somewhere outside, I see that modal shows something like <div height="500" role="presentation" class="bx--modal" tabindex="-1"> in Chrome DevTools console.

@zbeedatm
Copy link
Author

I captured the screen, I don't get any div when clicking outside!
PSB this video:
https://drive.google.com/drive/u/0/folders/1XCDEFE03nWzLyksdUcbfm2OAcP5GAJbI

@asudoh
Copy link
Contributor

asudoh commented Nov 19, 2019

Seems that the fix is not in v10.7.4 code whereas it's in master. Sorry and stay tuned for an upcoming release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants