1

I see following error in my website:

[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. I searched a lot about this error and I already seen several topics about it but it couldn't help me. So I have to ask this question directly. I know following part of code needs to edit

// if preventDefault exists run it on the original event
        if ( e.preventDefault ) {
            e.preventDefault();

or probably a part of this code:

jQuery.Event.prototype = {
    preventDefault: function() {
        this.isDefaultPrevented = returnTrue;

        var e = this.originalEvent;
        if ( !e ) {
            return;
        }

        // if preventDefault exists run it on the original event
        if ( e.preventDefault ) {
            e.preventDefault();

        // otherwise set the returnValue property of the original event to false (IE)
        } else {
            e.returnValue = false;          
        }
    },
    stopPropagation: function() {
        this.isPropagationStopped = returnTrue;

        var e = this.originalEvent;
        if ( !e ) {
            return;
        }
        // if stopPropagation exists run it on the original event
        if ( e.stopPropagation ) {
            e.stopPropagation();
        }
        // otherwise set the cancelBubble property of the original event to true (IE)
        e.cancelBubble = true;
    },
    stopImmediatePropagation: function() {
        this.isImmediatePropagationStopped = returnTrue;
        this.stopPropagation();
    },
    isDefaultPrevented: returnFalse,
    isPropagationStopped: returnFalse,
    isImmediatePropagationStopped: returnFalse
};

After a lot of searches I did find that I should add {passive: false} somewhere in above code but I don't know exactly where? (as I'm not programmer). Can you show it please Also please do not close this question as a duplicate because it's not. thanks

freedomn-m
  • 27,664
  • 8
  • 35
  • 57
Domains G
  • 11
  • 4
  • Have you looked at other questions related to this error message, like https://stackoverflow.com/questions/42101723/unable-to-preventdefault-inside-passive-event-listener – Barmar Feb 15 '23 at 17:52
  • I did and it didn't helped me. that's why I'm asking question here. – Domains G Feb 15 '23 at 17:55

0 Answers0