pIvan / ngx-color-picker

Pure Angular color picker library.
MIT License
94 stars 17 forks source link

Get rid of non-passive events violation warning #56

Closed Etienne-Buschong closed 1 year ago

Etienne-Buschong commented 2 years ago

Hi @pIvan , when using any (or most) of the color-picker-parts, i get a

[Violation]Added non-passive event listener to a scroll-blocking Ereignis. Consider marking event handler as 'passive' to make the page more responsive.

warning.

This is caused by the touchstart @HostListeners in the color-picker-parts, without the passive flag.

Here are the locations where touchstart is used: https://github.com/pIvan/ngx-color-picker/search?q=touchstart

Can you consider switching them to classic event listeners (as angular hostlisteners does not support this yet) and adding the passive options to follow best standards and get rid of the warnings?

Thanks Etienne

pIvan commented 2 years ago

Hi @Etienne-Buschong thank you for pointed out to me the problem with events. I'll try to switch them to the event listeners with passive flag

pIvan commented 2 years ago

This is something that has been fixed on the latest 14.x.x version of Angular, do you need it on older versions?

Etienne-Buschong commented 2 years ago

We are currently using angular 14.0.1, where the problem still persists. Can you point me to the minimum minor/patch version where this problem is solved?

I think that it would also be beneficial to have this "fix" in older angular versions, since not all developers are able to use angular >= v14 in their projects.

pIvan commented 2 years ago

Hi @ Etienne-Buschong the problem is solved in ngx-color-picker version 14.1.0, I will try lower the correction to an older version this week