-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
add support for touch event #39
Conversation
fraserxu
commented
Jan 4, 2015
- For the option, I add an onClick event
- For the clear button, I add an onClick event
- For the wrapper, I add an onTouchEnd event
- For the Value.js, I add an onTouchEnd event
@@ -17,7 +17,7 @@ var Option = React.createClass({ | |||
render: function() { | |||
return ( | |||
<div className="Select-item"> | |||
<span className="Select-item-icon" onMouseDown={this.blockEvent} onClick={this.props.onRemove}>×</span> | |||
<span className="Select-item-icon" onMouseDown={this.blockEvent} onClick={this.props.onRemove} onTouchEnd={this.props.onRemove}>×</span> |
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.
Shouldn't the onClick
handler still fire here on a touch device? or is it blocked by the onMouseDown
handler?
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.
No, I tested, the onClick
does not fire on a touch device.
Add the onTouchEnd
will make it work.
I also tried to change the onTouchEnd
handler to
onTouchHanlder: function(e) {
this.blockEvent(e)
this.props.onRemove()
}
to prevent the input filed from focusing, but seems not work.
Thanks @fraserxu. I was initially concerned that binding both |
Hi @JedWatson I checked the Till now all seems work well for me. |
Cool. I'll merge it now so we can finally support mobile devices. |