Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Everything to do with Joomla! 3.x templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
User avatar
sashaiel
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 116
Joined: Mon May 18, 2009 12:04 am

Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Post by sashaiel » Sat Jan 28, 2023 1:55 pm

Hi friends,
When I open articles in my joomla site (http://dev.harfrooz.com), I see following error in chrome developer tools:

Code: Select all

jquery-1.7.1.min.js:3 [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/feature/6662647093133312
preventDefault @ jquery-1.7.1.min.js:3
I searched for a solution and I find out I should add this code somewhere

Code: Select all

"touch-action: none;"
but I can't find out where is the right place to put it?

another solution was to remove preventDefault() which I tried to do that but it will disable popup window. maybe I'm doing it in wrong way I don't know?
Can you help about this please

p.s: I also attached jquery-1.7.1 file here.
You do not have the required permissions to view the files attached to this post.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30769
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Post by Per Yngve Berg » Sat Jan 28, 2023 5:12 pm

Try to load the Jquery from /media/jui/js. This is the version supplied by Joomla.

Are you running J3.10.11?

User avatar
sashaiel
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 116
Joined: Mon May 18, 2009 12:04 am

Re: Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Post by sashaiel » Sun Jan 29, 2023 11:55 am

Per Yngve Berg wrote:
Sat Jan 28, 2023 5:12 pm
Try to load the Jquery from /media/jui/js. This is the version supplied by Joomla.

Are you running J3.10.11?
Hi, Thanks for reply.
Yes I'm running Joomla 3.10.11 ; How can I use the version supplied by joomla? please explain more I'm very beginner at coding.
I tried to add following code to index.php file inside my template folder:

Code: Select all

<script type="text/javascript" src="<?php echo $this->baseurl ?>/media/jui/js/jquery.min.js"></script>
but my popup for articles disabled and I see following error now:

Code: Select all

script.js:149 Uncaught TypeError: jmainnav.getElement is not a function
    at Object.check (script.js:149:29)
    at Object.initialize (script.js:58:14)
    at HTMLDocument.<anonymous> (script.js:441:14)
    at n (jquery-1.7.1.min.js:2:14784)
    at Object.fireWith (jquery-1.7.1.min.js:2:15553)
    at Function.ready (jquery-1.7.1.min.js:2:9773)
    at HTMLDocument.B (jquery-1.7.1.min.js:2:14348)

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30769
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Post by Per Yngve Berg » Sun Jan 29, 2023 1:47 pm

Delete or rename the jquery-1.7.1.min.js file to prevent it from loading.

Have you contacted the template developer?
Last edited by imanickam on Tue Feb 28, 2023 12:20 pm, edited 1 time in total.
Reason: Removed the URL of the template as per the request of the user who created the topic.

User avatar
sashaiel
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 116
Joined: Mon May 18, 2009 12:04 am

Re: Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Post by sashaiel » Sun Jan 29, 2023 9:44 pm

Per Yngve Berg wrote:
Sun Jan 29, 2023 1:47 pm
Delete or rename the jquery-1.7.1.min.js file to prevent it from loading.

Have you contacted the template developer?
Hi,
Yes, I already contacted the developer and they replied me that this template is very old and they have no more support or update for the template. (also I use their final version, my template is not different)

I deleted the file jquery-1.7.1.min.js . The popup still working (which is a good thing) but the error changed to the following:

Code: Select all

[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/feature/6662647093133312
preventDefault @ jquery.min.js:2
_wheel @ iscroll.js:725
r @ jquery.min.js:2
dispatch @ jquery.min.js:2
handler @ jquery.mousewheel.js:81
You can see it in site.
Last edited by imanickam on Tue Feb 28, 2023 12:21 pm, edited 1 time in total.
Reason: Removed the URL of the template as per the request of the user who created the topic.

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1580
Joined: Tue Jun 30, 2020 12:17 pm

Re: Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Post by Pavel-ww » Mon Jan 30, 2023 9:06 am

Hi. Perhaps this article will help you

Code: Select all

https://www.uriports.com/blog/easy-fix-for-unable-to-preventdefault-inside-passive-event-listener/

User avatar
sashaiel
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 116
Joined: Mon May 18, 2009 12:04 am

Re: Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Post by sashaiel » Mon Jan 30, 2023 2:28 pm

Pavel-ww wrote:
Mon Jan 30, 2023 9:06 am
Hi. Perhaps this article will help you

Code: Select all

https://www.uriports.com/blog/easy-fix-for-unable-to-preventdefault-inside-passive-event-listener/
Hello Pavel
thanks for the reply. Well, to be honest, I had seen that article before, but I didn't understand what exactly I should do. Should I change the contents of jquery.js or is it related to another file?
Inside the jquery.js file, I can't find such a mentioned section. Please take a look at the attached file in my first post.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30769
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Post by Per Yngve Berg » Mon Jan 30, 2023 2:55 pm

You have to look in jquery.mousewheel.js:81

User avatar
sashaiel
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 116
Joined: Mon May 18, 2009 12:04 am

Re: Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Post by sashaiel » Mon Jan 30, 2023 4:19 pm

Per Yngve Berg wrote:
Mon Jan 30, 2023 2:55 pm
You have to look in jquery.mousewheel.js:81
following is the content of "jquery.mousewheel.js" But I can't understand how to solve the problem.

Code: Select all

/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 * Thanks to: Seamus Leahy for adding deltaX and deltaY
 *
 * Version: 3.0.6
 * 
 * Requires: 1.2.2+
 */

(function($) {

var types = ['DOMMouseScroll', 'mousewheel'];

if ($.event.fixHooks) {
    for ( var i=types.length; i; ) {
        $.event.fixHooks[ types[--i] ] = $.event.mouseHooks;
    }
}

$.event.special.mousewheel = {
    setup: function() {
        if ( this.addEventListener ) {
            for ( var i=types.length; i; ) {
                this.addEventListener( types[--i], handler, false );
            }
        } else {
            this.onmousewheel = handler;
        }
    },
    
    teardown: function() {
        if ( this.removeEventListener ) {
            for ( var i=types.length; i; ) {
                this.removeEventListener( types[--i], handler, false );
            }
        } else {
            this.onmousewheel = null;
        }
    }
};

$.fn.extend({
    mousewheel: function(fn) {
        return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
    },
    
    unmousewheel: function(fn) {
        return this.unbind("mousewheel", fn);
    }
});


function handler(event) {
    var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
    event = $.event.fix(orgEvent);
    event.type = "mousewheel";
    
    // Old school scrollwheel delta
    if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/60; }
    if ( orgEvent.detail     ) { delta = -orgEvent.detail/2; }
    
    // New school multidimensional scroll (touchpads) deltas
    deltaY = delta;
    
    // Gecko
    if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
        deltaY = 0;
        deltaX = -1*delta;
    }
    
    // Webkit
    if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/60; }
    if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/60; }
    
    // Add event and delta to the front of the arguments
    args.unshift(event, delta, deltaX, deltaY);
    
    return ($.event.dispatch || $.event.handle).apply(this, args);
}

})(jQuery);
Even when I removed the $.event.handle from the last line, the page scrolling stopped, but rolling the mouse wheel still sent the error and pointed to the jquery.min.js file.

Code: Select all

jquery.min.js:2 [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/feature/6662647093133312
preventDefault @ jquery.min.js:2

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1580
Joined: Tue Jun 30, 2020 12:17 pm

Re: Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Post by Pavel-ww » Mon Jan 30, 2023 4:46 pm

sashaiel wrote:
Mon Jan 30, 2023 4:19 pm
...pointed to the jquery.min.js file.
It is not pointed to the jquery.min.js file. This simply reports that for the JQuery library there are not enough some things to correctly process the code. Never edit the jQuery library. There are no errors. A link to a file which contains an error, you can see on the right side in the console.
1.jpg
In order to understand the software code, you need to plunge into it to completely determine its logic. Therefore, laying out parts of the code here you will not get a result. Just hire a programmer who will fix all problems. I don't think it will be expensive. I do this way when I cannot solve the problem myself.
You do not have the required permissions to view the files attached to this post.

User avatar
sashaiel
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 116
Joined: Mon May 18, 2009 12:04 am

Re: Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Post by sashaiel » Mon Jan 30, 2023 8:12 pm

Pavel-ww wrote:
Mon Jan 30, 2023 4:46 pm
sashaiel wrote:
Mon Jan 30, 2023 4:19 pm
...pointed to the jquery.min.js file.
Just hire a programmer who will fix all problems. I don't think it will be expensive. I do this way when I cannot solve the problem myself.
Hi pavel,
I know you are right and without a doubt this is the best and easiest way to solve the problem. But unfortunately, for some reasons, it is not possible for me at the moment.
But anyway, I think it's better for me to forget solving this problem for now, because it doesn't seem to have a simple solution and it requires programming knowledge. Also, this problem did not arise due to my changes in the template and it is in the original template itself.

At the same time, I still have another question that unfortunately came up, but it is technically related to css, and I think the solution is not too difficult for you.
I needed a commenting component for my articles. I tested several different models, but I encountered the same problem in all of them.
The problem is that in mobile phones, data entry form does not activate by touch (so I can’t enter information). And this problem does not exist in the computer.
so, It seems the form’s inputbox works with mouse click, but it does not work with a touch.
What could be the reason?
you can see the problem here: http://test5.harfrooz.com
I’ll be thankful for any help, and I really apologize as I already asked you many questions.
You do not have the required permissions to view the files attached to this post.

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1580
Joined: Tue Jun 30, 2020 12:17 pm

Re: Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Post by Pavel-ww » Tue Jan 31, 2023 7:16 am

Hi. To determine the cause requires a mobile emulator. I do not have such a tool, so I can give advice in blind. Try something like this.

Code: Select all

.formName {
	pointer-events: none;
}

User avatar
sashaiel
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 116
Joined: Mon May 18, 2009 12:04 am

Re: Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Post by sashaiel » Tue Jan 31, 2023 2:11 pm

Pavel-ww wrote:
Tue Jan 31, 2023 7:16 am
Hi. To determine the cause requires a mobile emulator. I do not have such a tool, so I can give advice in blind. Try something like this.

Code: Select all

.formName {
	pointer-events: none;
}
Hi Pavel,
I test that in several locations but it's not working. Any other ideas about this?
can't we expand the area of text to cover the "input form area", ? so when user click on empty form, he actually click on text box which working in mobiles too!?

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1580
Joined: Tue Jun 30, 2020 12:17 pm

Re: Error: Unable to preventDefault inside passive event listener due to target being treated as passive

Post by Pavel-ww » Tue Jan 31, 2023 4:28 pm

I have no ideas unfortunately


Locked

Return to “Templates for Joomla! 3.x”