'focus' event not firing for controller elements
Closed this issue · 3 comments
This event doesn't work in my controller:
events: {
'focus textarea': 'focusTextareaFn',
},
This works, but does not produce the intended effect:
events: {
'click textarea': 'focusTextareaFn',
},
Also, when I specify the event manually in the render function, it works:
textarea.onfocus = this.focusTextareaFn.bind(this);
Note the textarea is appended to a container and into this.el
via the this.html
function.
This explains it pretty well: http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
Turns out that 'focus' and 'blur' events are one of the few in JS that don't bubble. So in order for them for work, "capturing" has to be enabled (true
to the third arg of addEventListener
).
One possible solution is to auto-capture events of a certain type (mootools does this with focus/blur when using addEvent).
Ok, should be fixed: ed54d4c
Thanks!
On Mon, Jul 13, 2015 at 4:22 PM, andrew lyon notifications@github.com
wrote:
—
Reply to this email directly or view it on GitHub
#31 (comment).