-
Notifications
You must be signed in to change notification settings - Fork 49.1k
Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When trying to render input[type="number"]
with active focus on click
state = {
isShown: true,
value: 0
}
componentDidUpdate() {
this.input && this.input.focus();
}
//...
render() {
return (
<td className="editable">
{!this.state.isShown ? (
<input
type="number"
ref={(input) => { this.input = input }}
value={this.state.value}
onChange={e =>
this.setState({
value: e.target.value
})}
onBlur={() => {this.setState({ isShown: true })}}
/>
) : (
<span onClick={() => {this.setState({ isShown: false })}}>Click me</span>
)}
</td>
)
}
onBlur
event triggers in Firefox, before even focus is set.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem:
Click on name column to render input[type="number"]
with active focus(works in Chrome, IE11, Edge, does not in Firefox). Please see live example:
https://codepen.io/piupiupiu/pen/KXXQdb?editors=0010
What is the expected behavior?
After clicking on name column input should appears with active focus
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React v15.4.2
Firefox v56.0 Win10
I'm not sure if this React issue actually, because I noticed that if you will change input type to text
if will works perfectly in Firefox(so the problem related only to input[type="number"])