-
Notifications
You must be signed in to change notification settings - Fork 1k
Checkbox / Radio: Setting checked attribute on underlying input #906 #939
Checkbox / Radio: Setting checked attribute on underlying input #906 #939
Conversation
This is working for me. I will look into it further. |
} | ||
this.state.checked = !this.state.checked; | ||
|
||
this._toggleCheckedState(); | ||
this.$element.trigger('change', e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might need to wrap this in the if(Boolean(e)){} check to make sure that e exists before you use it. This function can be called from JS without an event having happened...
@BenjaminNeilDavis Yeah, let's wrap the event in an if and clean up the comments. Great find though! |
0a46f3b
to
bacd170
Compare
# The first commit's message is: Checkbox / Radio: Setting checked attribute on underlying input #906 # This is the 2nd commit message: bump dist # This is the 3rd commit message: Checkbox / Radio: Setting checked attribute on underlying input #906
bacd170
to
9a4721f
Compare
…event
Checkbox / Radio: Setting checked attribute on underlying input #906. Fixes #941.
@@ -113,15 +113,14 @@ | |||
toggle: function(e) { | |||
//keep event from firing twice in Chrome | |||
if (!e || (e.target === e.originalEvent.target)) { | |||
if(Boolean(e)){ | |||
//stop bubbling, otherwise event fires twice in Firefox. | |||
e.preventDefault(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WAIT! what happened to e.preventDefault()??? This was necessary to fix Firefox firing the event twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, just tested, you broke Firefox. I'll fix...
(refix-firefox-checkbox) fix firefox bug where checkbox appears to not... Fixes bug introduced by #939.
Checkbox / Radio: Setting checked attribute on underlying input #906