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

OverlayPanel, Popover: Changing the dismissable property after the overlayPanel has already been opened has no effect. #15964

Closed
can-oezkan opened this issue Jul 5, 2024 · 1 comment · Fixed by #16941
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@can-oezkan
Copy link
Contributor

can-oezkan commented Jul 5, 2024

Describe the bug

Changing the dismissable property after the overlayPanel has already been opened has no effect.

Environment

unrelated

Reproducer

https://stackblitz.com/edit/github-rhrnsr?file=src%2Fapp%2Fapp.component.html

Angular version

18.2.12

PrimeNG version

18.0.0-rc1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

unrelated

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

The current value of the property dismissable should be respected.

@can-oezkan can-oezkan added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 5, 2024
@can-oezkan can-oezkan changed the title OverlayPanel: Property dismissable cannot be modified after overlayPanel is visible OverlayPanel: Changing the dismissable property after the overlayPanel has already been opened has no effect. Jul 5, 2024
@leozulfiu
Copy link

leozulfiu commented Aug 13, 2024

Hi @can-oezkan

I just ran into the same problem where I have a button on my overlay and clicking it (which fires a request + polling), I want to make the overlay not dismissable until I get a certain response. Binding a variable to [dismissable]="isDialogDismissable" didn't work either as you tested it. Looking in the code of the overlay I saw that the dismissable Input doesn't get re-evaluated when it changes: https://github.com/primefaces/primeng/blob/master/src/app/components/overlaypanel/overlaypanel.ts#L242

What I did was simply calling the methods unbindDocumentClickListener when I press the button (to make it not dismissable) and unbindDocumentClickListener when I want to make my overlay dismissable again.

This is what I have in my parent component:

  @ViewChild('op') overlayPanel: OverlayPanel;

...
  handle(isGenerating: boolean) {
    if (isGenerating) {
      this.overlayPanel.unbindDocumentClickListener();
    } else {
      this.overlayPanel.bindDocumentClickListener();
    }
  }

And handle gets called via an Output from the child itself. The dismissable input is not even needed in that case:

<p-overlayPanel
- [dismissable]="isDialogDismissable" >
   ...
</p-overlayPanel>

It's quite a hacky solution since you call rather internal methods which could break in future releases. Fixing this bug should be easy, I hope somebody with more knowledge than me can do that.

@can-oezkan can-oezkan changed the title OverlayPanel: Changing the dismissable property after the overlayPanel has already been opened has no effect. OverlayPanel, Popover: Changing the dismissable property after the overlayPanel has already been opened has no effect. Dec 4, 2024
@mertsincan mertsincan added Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Dec 6, 2024
@mertsincan mertsincan added this to the 18.0.1 milestone Dec 6, 2024
@mertsincan mertsincan moved this to Done in PrimeNG Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
Status: Done
3 participants