Skip to content

[colReorder] warning Added non-passive event listener to a scroll-blocking #487

Open

Description

@lenamtl

I'm testing colReorder v 1.5.2

I'm getting this warning
Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive.

Activity

  1. changed the title [-][colReorder] warning [/-] [+][colReorder] warning Added non-passive event listener to a scroll-blocking[/+] on Aug 14, 2020
  2. lenamtl commented on Aug 16, 2020

    @lenamtl
    Author

    Hi, to see the warning just go to https://datatables.net/extensions/colreorder/examples/initialisation/simple.html
    and open Chrome dev tool right click inspect tehn check console tab.

    This should be fixed as Chrome staring to turn these warning to error in some case.

  3. lenamtl commented on Aug 24, 2020

    @lenamtl
    Author

    This should be reopen to make sure this get fixed

  4. lenamtl commented on Apr 29, 2022

    @lenamtl
    Author

    This issue is still present

    Here is my actual solution, I placed this code completey at the end of the page after Datatables

    if (typeof EventTarget !== "undefined") {
    	let func = EventTarget.prototype.addEventListener;
    	EventTarget.prototype.addEventListener = function (type, fn, capture) {
    		this.func = func;
    		if(typeof capture !== "boolean"){
    			capture = capture || {};
    			capture.passive = false;
    		}
    		this.func(type, fn, capture);
    	};
    };  
    
  5. AllanJard commented on Apr 30, 2022

    @AllanJard
    Contributor

    That looks like it would make all non capture events passive on the page? I wouldn't feel comfortable putting that into the library.

    Part of the issue is that there isn't yet a jQuery way of assigning a passive event listener. We'll probably just need to restrict our browser support and use the event natively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions