150
rated 0 times
[
151]
[
1]
/ answers: 1 / hits: 21000
/ 10 Years ago, sun, march 2, 2014, 12:00:00
I'm unable to get any of the React SyntheticKeyboardEvent
handlers to register anything except null
for the event properties.
I've isolated the component in a fiddle and am getting the same result as in my application. Can anyone see what I'm doing wrong?
http://jsfiddle.net/kb3gN/1405/
var Hello = React.createClass({
render: function() {
return (
<div>
<p contentEditable=true
onKeyDown={this.handleKeyDown}
onKeyUp={this.handleKeyUp}
onKeyPress={this.handleKeyPress}>Foobar</p>
<textarea
onKeyDown={this.handleKeyDown}
onKeyUp={this.handleKeyUp}
onKeyPress={this.handleKeyPress}>
</textarea>
<div>
<input type=text name=foo
onKeyDown={this.handleKeyDown}
onKeyUp={this.handleKeyUp}
onKeyPress={this.handleKeyPress} />
</div>
</div>
);
},
handleKeyDown: function(e) {
console.log(e);
},
handleKeyUp: function(e) {
console.log(e);
},
handleKeyPress: function(e) {
console.log(e);
}
});
React.renderComponent(<Hello />, document.body);
More From » reactjs