Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lenamtl opened this issue Aug 14, 2020 · 6 comments
Open

Comments

@lenamtl
Copy link

lenamtl commented Aug 14, 2020

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.

@lenamtl lenamtl changed the title [colReorder] warning [colReorder] warning Added non-passive event listener to a scroll-blocking Aug 14, 2020
@lenamtl
Copy link
Author

lenamtl commented Aug 16, 2020

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.

@lenamtl
Copy link
Author

lenamtl commented Aug 24, 2020

This should be reopen to make sure this get fixed

@DataTables DataTables reopened this Aug 24, 2020
@DataTables
Copy link
Collaborator

We've got it in our own tracker, and also it is in the forum, but yes, it can be open here as well.

@lenamtl
Copy link
Author

lenamtl commented Apr 29, 2022

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);
	};
};  

@AllanJard
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants