primeng icon indicating copy to clipboard operation
primeng copied to clipboard

p-calendar datepicker is closing when scrolling on container

Open shakedSetoo opened this issue 5 years ago • 19 comments

If you have a PrimeNG PRO Support subscription please post your issue at;

https://pro.primefaces.org

where our team will respond within 4 business hours.

If you do not have a PrimeNG PRO Support subscription, fill-in the report below. Please note that your issue will be added to the waiting list of community issues and will be reviewed on a first-come first-serve basis, as a result, the support team is unable to guarantee a specific schedule on when it will be reviewed. Thank you for your understanding.

Current Queue Time for Review Without PRO Support: ~8-12 weeks. With PRO Support: 1 hour

I'm submitting a ... (check one with "x")

[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports) Please demonstrate your case at stackblitz by using the issue template below. Issues without a test case have much less possibility to be reviewd in detail and assisted.

https://stackblitz.com/edit/github-i6mewe?file=src/app/app.component.html

Current behavior

Using p-calendar in a modal with scroll causes the datepicker to close when scrolling. in version 11.1.0 this does not happen.

Expected behavior

scrolling on the modal should not close the datepicker

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

angular 11 with primeng 11.2.2

  • Angular version: 5.X

angular 11

  • PrimeNG version: 5.X

11.2.2

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

chrome

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (for AoT issues): node --version =

shakedSetoo avatar Feb 15 '21 12:02 shakedSetoo

I also facing this issue. I notice that it only happens if we use flex layout and wrapper div has CSS property-> flex: 1; overflow: auto;

Thanks Rajneesh Joshi

rajneeshjoshi4 avatar May 18 '21 06:05 rajneeshjoshi4

@rajneeshjoshi4 We can solve this by adding overflow : overlay; To the container and it works for me

hrp03 avatar May 25 '21 12:05 hrp03

Thanks @hrp03
overflow : overlay; is a non-standard value only supported by the WebKit-browsers but is now depreciated and it is the same as auto does. You must see it: Browser support

rajneeshjoshi4 avatar May 26 '21 08:05 rajneeshjoshi4

Am also facing the same issue ....whats the solution now ..... can anyone help

Pranaywebdeveloper avatar May 26 '21 15:05 Pranaywebdeveloper

I'm seeing a similar issue, in my case it's not closing immediately after scrolling every time. Sometimes it stays open, but will close when I attempt to interact with any portion of the popup that was previously out of view before being scrolled into view.

I'm seeing that the overlayAnimation is being triggered or is the trigger when the close event is fired.

jamespero avatar Jul 20 '21 17:07 jamespero

Same issue here, following...

bobanmarkovic avatar Mar 31 '22 14:03 bobanmarkovic

I am also facing the exact same issue. Would be great is someone could fix it.

MRL-00 avatar Apr 27 '22 09:04 MRL-00

Using appendTo property on p-calendar inside the p-dialog fixed this issue for me

appendTo="body"

iamsaaki avatar May 06 '22 14:05 iamsaaki

@rajneeshjoshi4 We can solve this by adding overflow : overlay; To the container and it works for me

Thank you so much! it works for me too! : D

vishwath-williams avatar Jun 17 '22 09:06 vishwath-williams

@ViewChild() inputDate: Calendar; ngAfterViewInit() { this.calendar.scrollHandler = { bindScrollListener : ()=>{} , unbindScrollListener : ()=>{} }; } The solution in angular.

damir-ovcina avatar Jun 21 '22 07:06 damir-ovcina

@damir-ovcina: your solution works partially, it throws the following error

ERROR Error: Uncaught (in promise): TypeError: this.scrollHandler.destroy is not a function TypeError: this.scrollHandler.destroy is not a function at Calendar.ngOnDestroy (primeng-calendar.mjs:2279:32) at executeOnDestroys (core.mjs:7601:32) at cleanUpView (core.mjs:7502:9) at destroyViewTree (core.mjs:7335:17) at destroyLView (core.mjs:7480:9) at RootViewRef.destroy (core.mjs:21935:9) at ComponentRef.destroy (core.mjs:22354:23)

spatil1240 avatar Jun 28 '22 10:06 spatil1240

@ViewChild() inputDate: Calendar; ngAfterViewInit() { this.calendar.scrollHandler = { bindScrollListener : ()=>{}, unbindScrollListener : ()=>{}, destroy : ()=>{} }; }

ryann3588 avatar Jul 07 '22 18:07 ryann3588

@ryann3588: yes I did the same change and it's working. but now the issue is when we scroll using the scrollbar the calendar disappears, but in case if scroll using touchpad it works.

spatil1240 avatar Jul 08 '22 08:07 spatil1240

@spatil1240 I believe it also hides on window resize. If you're testing on a mobile device, that might be causing the problem.

ryann3588 avatar Jul 08 '22 12:07 ryann3588

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,

mertsincan avatar Nov 09 '22 20:11 mertsincan

Hi there! The problem is no improvement yet! v.9.6.0

webtack avatar Aug 12 '23 07:08 webtack

@mertsincan As per above - this has not been solved and is still a problem

slavco86 avatar Jul 18 '24 13:07 slavco86

Hi, I had the same issue in my angular 18 application. please help me, without appendTo property can we solve this issue. I am using primeng 19.0.5 version

rama401 avatar Feb 08 '25 06:02 rama401

I was experiencing the same issue on PrimeReact v9.5.0. After upgrading to v10.9.6, the issue appears to be resolved.

felixkpt avatar Aug 13 '25 10:08 felixkpt