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

Modals are not reopening if we close it by clicking ESC button #3004

Closed
SowjanyaKrishnamurthy opened this issue Sep 23, 2024 · 5 comments · Fixed by #3016
Closed

Modals are not reopening if we close it by clicking ESC button #3004

SowjanyaKrishnamurthy opened this issue Sep 23, 2024 · 5 comments · Fixed by #3016

Comments

@SowjanyaKrishnamurthy
Copy link

Detailed description

Describe in detail the issue you're having.
After closing the modal onclick of ESC Button, we are not able to open any of the modal in the application.

Is this a feature request (new component, new icon), a bug, or a general issue?
Bug

Is this issue related to a specific component?
Modals

What did you expect to happen? What happened instead? What would you like to see changed?
If we close the modals by clicking ESC button, we should be able to open again. Instead none of the modals are opening after closing modal by ESC button.

What browser are you working in?
Chrome

What version of the Carbon Design System are you using?
"carbon-components-angular": "^5.28.1",
"@carbon/icons": "^11.45.0",
"@carbon/styles": "^1.61.0",
"@carbon/type": "^11.25.0",

Steps to reproduce the issue

Step 1: Open any modal
Step 2: Close by clicking ESC button
Step 3: Open modal again

@eduardmarcinco
Copy link
Contributor

Hello, can you please share a code snippet or a minimal reproduction of the issue?

@SowjanyaKrishnamurthy
Copy link
Author

SowjanyaKrishnamurthy commented Sep 25, 2024

Hi @eduardmarcinco,
You can create a sample modal with "carbon-components-angular": "^5.28.1" version.
Step 1: Open a Modal
Step 2: press ESC button, modal gets closed
Step 3: try to open modal again

You can refer below sample code as well
https://codesandbox.io/p/devbox/4w58pv

@eduardmarcinco
Copy link
Contributor

eduardmarcinco commented Sep 25, 2024

I can see the issue in this story -> https://angular.carbondesignsystem.com/?path=/story/components-modal--simple

If you use this way of creating modals, you need to add (close)="open = false" on cds-modal element.

Example:

<button #trigger cdsButton="primary" (click)="open = true">Open</button>
  <cds-modal [open]="open" [trigger]="trigger" (overlaySelected)="open = false" (close)="open = false">
  ... 

Does this fix your issue?

@eduardmarcinco
Copy link
Contributor

Okay, I see the codesandbox now.
Update the cds-modal in your code to:

<cds-modal [open]="sampleModal" (overlaySelected)="true" size="sm" (close)="sampleModal = false">

Add (close)="sampleModal = false" and it should work for you.

@SowjanyaKrishnamurthy
Copy link
Author

Hi, The above solution works. Thank you so much

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