Dynamic created gauge(s) get violation warnings "non-passive event listener"

Posted by: developer on 22 August 2018, 11:58 pm EST

    • Post Options:
    • Link

    Posted 22 August 2018, 11:58 pm EST

    Hello, we create Radial- and linear gauges (wijmo v5.20182.500) by .ts code (Angular 6 SPA):

    
      this.wijmoGauge = new wjcGauge.LinearGauge('#gaugeDynamicContainer', {
                    isReadOnly: true
                });
    
    

    If we run the app and start chrome, activate Dev-Console (filter: All !), we get such messages at gauge creation(s):

    
    [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
    [Violation] Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
    zone.min.js:1 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
    
    

    As the docs https://www.chromestatus.com/feature/5745543795965952 state: set “passive” can be used to dramatically improve scrolling performance.

  • Posted 23 August 2018, 7:28 pm EST

    Hi,

    Passive event handlers are used in cases where the event handler is not supposed to cancel the event i.e does not call preventDefault(). Setting the passive flag to true informs the browser that this event handler is not supposed to cancel the event so there is no need to wait for it to finish execution and browser may proceed to scroll which in turn improves scrolling performance.

    Now in cases where event handler is supposed to cancel the event( as the gauge is supposed to prevent window scrolling when scrolling is performed on the gauge) passive event handlers cannot be used.

    So the warning is just to inform us so that we won’t forget to use passive flag where we can. Although the warning can be removed by setting the passive flag to false but it won’t have any effect on performance as compared to without using passive flag.

    So if you are concerned about the warning message, we can ask the dev team to do something about it. Do you want us to make a request for removing warning about passive event listeners?

    Please refer here for more info on passive event listeners:- https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md

    ~Sharad

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels