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 Component Closes on click of overlay-panel-content #14177

Closed
PraveenRL opened this issue Nov 22, 2023 · 11 comments
Closed

OverlayPanel Component Closes on click of overlay-panel-content #14177

PraveenRL opened this issue Nov 22, 2023 · 11 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@PraveenRL
Copy link

PraveenRL commented Nov 22, 2023

Describe the bug

Hello, I'm experiencing an issue between PrimeNG versions. In version 16.8.0, the overlay is closing when clicking it's own content.

To make the scenario clear, I'm using p-calendar (selectionMode="range") inside p-overlayPanel for some purpose. On selecting the date it's okay, but on click of month change icons, month, year and in month/year selection mode selecting month and year it's getting closed.

This issue was not occurred in v16.2.0, but in latest version eg: v16.7.2, v16.8.0 this issue occurs.

Environment

Windows 10

Reproducer

https://stackblitz.com/edit/overlay-panel-close-on-its-content-v16-8-0?file=package.json

Angular version

16.2.1

PrimeNG version

^16.8.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.10.0

Browser(s)

All, Chrome, Edge latest version

Steps to reproduce the behavior

  1. Click on Start Date field, popup will open
  2. Click on Month navigation change icons, the popup will get closed
  3. Similarly on click of month and year, it's getting closed

Expected behavior

  1. Click on Start Date field, popup should open - OK
  2. Click on Month navigation change icons, the popup should not close, it will navigate to next and previous month
  3. Similarly on click of month and year, the popup should not close, month/year view should shown and select month or year, on selecting these the popup should not gets closed.
  4. It should close only on click outside popup
@PraveenRL PraveenRL added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 22, 2023
@erber014
Copy link

We have the same issue in our application, we are using calendars, checkboxes and a table in our overlayPanel and these all trigger a close of the overlayPanel for several different interactions with these components.

@pete-mcwilliams
Copy link
Contributor

#13605 was supposed to be fixed in 16.7.0 but it does not look like it was.
https://stackblitz.com/edit/xzstuc?file=package.json

@macallejah
Copy link

macallejah commented Nov 23, 2023

We have same issues in our application, we use multiselect inside overlay-panel, when we delete selected item on multiselect, overlay-panel close.

We believe that the problem is that the event to remove the element from the multiselect arrives before and delete selection, and then the overlay-panel check to see if the click has come from a component inside it and it is not on its list and decide to close the overlay.

bindDocumentClickListener() {
if (isPlatformBrowser(this.platformId)) {
if (!this.documentClickListener && this.dismissable) {
let documentEvent = DomHandler.isIOS() ? 'touchstart' : 'click';
const documentTarget = this.el ? this.el.nativeElement.ownerDocument : this.document;
this.documentClickListener = this.renderer.listen(documentTarget, documentEvent, (event) => {
if (!this.container?.contains(event.target) && this.target !== event.target && !this.target.contains(event.target)) {
this.hide(); ---> HERE OVERLAYPANEL IS CLOSED
}
this.cd.markForCheck();
});
}
}
}

@pete-mcwilliams
Copy link
Contributor

e26b9ee this commit removed the check for !this.selfclick which is set by

            this.overlayEventListener = (e) => {
                if (this.container && this.container.contains(e.target)) {
                    this.selfClick = true;
                }
            };

            this.overlaySubscription = this.overlayService.clickObservable.subscribe(this.overlayEventListener);

@hervehobbes
Copy link

hervehobbes commented Nov 30, 2023

Hello,
Same problem for me but just with the multiSelect component.
Each time we click on the panel used to show multiselect options, it will close itself automatically.

  • Primeng: 16.5.1
  • Angular: 16.2.6
  • Node: 18.18.2
  • NPM: 9.8.1

@MartinMa
Copy link

MartinMa commented Dec 4, 2023

Having the same issue with current PrimeNG version 16.9.1.

@hervehobbes
Copy link

hervehobbes commented Dec 7, 2023

Problem solved by adding this to the multiselect tag :
appendTo="body"

@pete-mcwilliams
Copy link
Contributor

appendTo="body" does not resolve the issue with inline calendar in overlay panels.

@roman-balzer
Copy link

roman-balzer commented Dec 11, 2023

simple (click)=func() on a div/component also closes the panel, v17 btw

#14120 (comment) for those that search a workaround

pete-mcwilliams added a commit to pete-mcwilliams/primeng that referenced this issue Jan 2, 2024
@FernandoBonfimArctica
Copy link

this bug continues on primeNg 16.9.1
any solution?

@mertsincan
Copy link
Member

Hi,

So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you reopen the issue so we can include it in our roadmap?
Please don't forget to add your feedback as a comment after reopening the issue. These will be taken into account by us and will contribute to the development of this feature. Thanks a lot for your understanding!

Best Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
9 participants