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

bug(cdk overlay): open/close overlay behavior #28949

Open
1 task
AnkitaSood opened this issue Apr 24, 2024 · 1 comment
Open
1 task

bug(cdk overlay): open/close overlay behavior #28949

AnkitaSood opened this issue Apr 24, 2024 · 1 comment
Labels
area: cdk/overlay P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@AnkitaSood
Copy link

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

The cdkoverlay doesn't close on click of the trigger button after it has been opened, if both (overlayOutsideClick)="isOpen=false" is added to the overlay template and (click)="isOpen = !isOpen" is added to the trigger button.

Reproduction

StackBlitz link: https://stackblitz.com/edit/nxazcw?file=src%2Fexample%2Fcdk-overlay-basic-example.html
Steps to reproduce:

  1. Click on a button to open the overlay.
  2. Click anywhere outside of the overlay, notice the overlay closes.
  3. Click on a button to open the overlay again.
  4. Click on the same button to close the overlay - notice that it doesn't close.

Expected Behavior

The overlay should close on click of the trigger button as well as when the user clicks anywhere outside the overlay.

Actual Behavior

If the ability the close the overlay by clicking anywhere outside is added, clicking on the button again doesn't close the overlay.

Environment

  • Angular: 17.3.1
  • CDK/Material: 17.3.1
  • Browser(s): All major browsers
  • Operating System (e.g. Windows, macOS, Ubuntu): All operating systems
@AnkitaSood AnkitaSood added the needs triage This issue needs to be triaged by the team label Apr 24, 2024
@PsychoSpike
Copy link

I can at least confirm this behavior.
The moment you use (overlayOutsideClick) on the template and the template gets called once, it seems the original (click) on the button stops firing.

@amysorto amysorto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: cdk/overlay and removed needs triage This issue needs to be triaged by the team labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: cdk/overlay P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

3 participants