fix: Annotate potentially blocking event listeners with passivity by gonfunko · Pull Request #9555 · RaspberryPiFoundation/blockly

The basics

The details

Resolves

Fixes #9542

Proposed Changes

This PR updates (conditional)Bind to take an additional optional parameter corresponding to the addEventListener options argument. This allows us to specify whether touchstart and wheel events are or are not passive. Passive events are those which will never call preventDefault(); in that case, performance can be improved because the browser can run the event handler asynchronously, whereas if there is a possibility of preventDefault() being called, the browser needs to run the whole event handler before scrolling or responding to the touch in case the event handler prevents it, which causes jank commensurate with the complexity of the event handler.

Chrome has started notifying about this in the console, so this also cleans that up. There is still some logging about touchstart in the advanced playground, but it seems that that's coming from one of its dependencies.