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

Calendar doesnt play well with OnPush change detection strategy #2148

Closed
external-olgierd opened this issue Feb 24, 2017 · 5 comments
Closed
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@external-olgierd
Copy link

I'm submitting a ...

[x ] bug report => Search github for a similar issue or PR before submitting

http://plnkr.co/edit/i58dTl1dQgrNmKQedcT5?p=preview

Current behavior
When is used within the component with OnPush change detection strategy, the closing of the datepicker popup is not working as expected:

  • datepicker is not closing when date is selected (need to click twice)
  • datepicker is not closing when focus is lost from the input field/when user clicks anywhere else on the screen

Expected behavior
Datepicker is closed when date is selected or when user clicks anywhere else on the screen.

Minimal reproduction of the problem with instructions
It affects any component that is added to the component with OnPush change detection strategy. See the above plunker.

What is the motivation / use case for changing the behavior?
OnPush change detection strategy is widely used in Angular2 apps for performance reasons so Calendar component should behave correctly in these cases.

Angular version: 2.0.0 and above (incl. most recent one)

PrimeNG version: 2.0.1

Browser: all

external-olgierd added a commit to external-olgierd/primeng that referenced this issue Feb 24, 2017
Added trigger for change detection in the body click handler. Fix for primefaces#2148.
@alialtun14
Copy link

Autocomplete component behaves in a similar way too.

@external-olgierd
Copy link
Author

@alialtun14 I suggest you log a new issue with relevant plunkr for autocomplete component. Probably the best way to get it fixed quickly.

@variable-content
Copy link

variable-content commented Mar 7, 2017

@alialtun14 I'm running into the same issue with the autocomplete component, have created this issue for it: #2226

@alialtun14
Copy link

alialtun14 commented Mar 7, 2017 via email

@cagataycivici cagataycivici self-assigned this Mar 27, 2017
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Mar 27, 2017
@cagataycivici cagataycivici added this to the 4.0.RC2 milestone Mar 27, 2017
@CelsoSantos
Copy link

CelsoSantos commented Jun 19, 2017

Hi everyone,
Hi @cagataycivici

I'm still having this issue on 2.0.6...

I have a calendar that I don't have any issue firing the focus event, however, the calendar consistently requires two clicks to select a date.

I did notice that the calendar css classes goes from having ui-inputwrapper-focus class to not having it on the first click, but only the second does actually change something and makes the onSelect event fire.

Wasn't this issue supposed to fix that?

EDIT

Also, I don't specify a change detection method

SOLVED

My issue was probably not related to this. See #2378

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

5 participants