New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onkeydown doesn't work #526

Closed
rudinandrey opened this Issue Mar 21, 2015 · 6 comments

Comments

Projects
None yet
4 participants
@rudinandrey

rudinandrey commented Mar 21, 2015

http://jsfiddle.net/rudinandrey/6uwdyzs1/

that is code... when I press button inside input text I will have nothing to input ( but event is work, i get keyCodes . What is wrong ?

@rsbondi

This comment has been minimized.

Show comment
Hide comment
@rsbondi

rsbondi Mar 22, 2015

Member

return true after the update, not sure why,

Member

rsbondi commented Mar 22, 2015

return true after the update, not sure why,

@cognitom

This comment has been minimized.

Show comment
Hide comment
@cognitom

cognitom Mar 22, 2015

Member

@rudinandrey .bind(this) is needed.
http://jsfiddle.net/cognitom/j2p8vu4s/

Or ES6 method is also OK: press (e) { ... }
http://jsfiddle.net/cognitom/32xbcc9p/

See Custom tag example.

Member

cognitom commented Mar 22, 2015

@rudinandrey .bind(this) is needed.
http://jsfiddle.net/cognitom/j2p8vu4s/

Or ES6 method is also OK: press (e) { ... }
http://jsfiddle.net/cognitom/32xbcc9p/

See Custom tag example.

@rsbondi

This comment has been minimized.

Show comment
Hide comment
@rsbondi

rsbondi Mar 22, 2015

Member

@cognitom neither of those work for me, the input is always empty.

Member

rsbondi commented Mar 22, 2015

@cognitom neither of those work for me, the input is always empty.

@GianlucaGuarini

This comment has been minimized.

Show comment
Hide comment
@GianlucaGuarini

GianlucaGuarini Mar 22, 2015

Member

Please check the riot documentation https://muut.com/riotjs/guide/#event-handlers

The default event handler behavior is automatically cancelled. This means that e.preventDefault() is already called for you, because this is what you usually want (or forget to do). You can let the browser do the default thing by returning true on the handler.

Member

GianlucaGuarini commented Mar 22, 2015

Please check the riot documentation https://muut.com/riotjs/guide/#event-handlers

The default event handler behavior is automatically cancelled. This means that e.preventDefault() is already called for you, because this is what you usually want (or forget to do). You can let the browser do the default thing by returning true on the handler.

@cognitom

This comment has been minimized.

Show comment
Hide comment
@cognitom

cognitom Mar 22, 2015

Member

@rsbondi sorry, you're right. I misread the question.
I've slightly updated my jsFiddle to work fine by adding an attribute value={ name } to the tag. It's another solution.

But I agree that return false is suitable in this situation.

Member

cognitom commented Mar 22, 2015

@rsbondi sorry, you're right. I misread the question.
I've slightly updated my jsFiddle to work fine by adding an attribute value={ name } to the tag. It's another solution.

But I agree that return false is suitable in this situation.

@rudinandrey

This comment has been minimized.

Show comment
Hide comment
@rudinandrey

rudinandrey Mar 22, 2015

@GianlucaGuarini thank you. This is very useful comment for me.

rudinandrey commented Mar 22, 2015

@GianlucaGuarini thank you. This is very useful comment for me.

@GianlucaGuarini GianlucaGuarini referenced this issue May 9, 2016

Closed

Riot 3.0.0 roadmap #1694

14 of 16 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment