shaack / cm-chessboard

A JavaScript chessboard without dependencies. Rendered in SVG, coded in ES6. Views FEN, handles move input, animated, responsive, expandable
MIT License
209 stars 63 forks source link

Chrome nn-passive event listener warning #114

Closed djeetee closed 1 year ago

djeetee commented 1 year ago

I have been ignoring the following warning that only shows up in chrome but now I need to figure out if it's because I'm doing or what.

the warning pops up in the console right after initializing a board.

image image

has anyone come across this?

thanks.

shaack commented 1 year ago

Hi! This warning seems to be quite new in Chrome. The fix may be easy to add {passive: true} options to the event listeners, but I am not sure how to deal with it because I am not sure what it means in its entirety to make a listener passive. I will read a few lines about it and then I will just try it out.

djeetee commented 1 year ago

fyi, FF doesn't show the warning. thanks for looking into this.

shaack commented 1 year ago

Okay, as I understand, the point is, that a passive event can not handle the preventDefault() command. But in cm-chessboard, wie need to prevent scrolling, when someone makes a move. So the question is, how to get rid of those warnings.

shaack commented 1 year ago

Fixed this by adding {passive: false} to the event listeners with version v7.3.17.

djeetee commented 1 year ago

Thank you!