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)
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.
Can you please provide live examples of what was working in previous versions and what it doesn't now?
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.
Issue #2337
[BUG / QUESTION] Deleting default styles does not work
Hello, i'm trying to delete some of the default styles of the blocks. I wrote everything I changed in a plugin. I used this function to upd...
Issue #3295
BUG (v0.16.41): Button component with draggable property is not working properly
Version: v0.16.41 Are you able to reproduce the bug from the demo? [ ] Yes [ ] No What is the expected behavior? When we have a button with...
Issue #2742
[QUESTION] How to prevent unique ids generation?
Hi! Thanks for your work @artf. This is a simplified code of how I use grapesjs, I want to save the styles and then want to apply them agai...
Issue #2514
[Question]: How to change device from dropdown to icon
I'm trying to replace the dropdown with icon for the devices following the example in the newsletter template yet it doesn't work.
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.