Issue #2225Opened August 28, 2019by mogolola0 reactions

events are not working properly on the release 0.15.3

Question

Hi,

The events mechanism seems have changed a lot since release 0.15x. For example, normally when we want to prevent the default button behavior, we will use "return false" at the end of the callback function, but this doesn't work anymore in this release (no matter what you return), I have to call "event.preventDefault()" manully. Another issue is that I can't use $.on to attach event listener. But using the pure JS method "addEventListener" is fine. I can't understand why but I believe this has something to do with the file "extender.js". It seems that you add something to deal with all events and there are some imperfection.

sincerely

Answers (3)

mogololaAugust 29, 20190 reactions

Also, events like "blur", "focus", (bascially everything except "click") don't work in backbone events configuration (by that I mean view events in backbone: https://backbonejs.org/#View-events ). for example: if I attach a callback to a "focus" event , the callback is never called. But callbacks to the "click" events can be called in response to the events , except "return false" seems useless.

artfSeptember 4, 20190 reactions

Can you please provide live examples of what was working in previous versions and what it doesn't now?

mogololaSeptember 5, 20190 reactions

Example 1:

events: { 
        'click button.gjs-load-doload': "doLoad",
        ...
    },
doLoad(e) {
        //as callback to a button click event, e.preventDefault() become necessary and can't be replaced 
 by return false
        e.preventDefault();
        ...
        // in the previous versions, only return false is enough to stop propagation and stop element default behaviour and there is no need to write e.preventDefault() manually
        return false;
    },

Example 2: When I try to attach event listeners, only callback to the click events can be called

       events:{
             /* click events are alright, the callback can be called */
            "click .gjs-indicator-checkbox-holder": 'toggle',
            'click .indicator-refresh-singleton':'refreshSingleton',
            /* blur and focus never works
            'blur .auto-refresh-interval-input':'updateInterval',
            'focus .auto-refresh-interval-input':'focus'*/
        },```

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.