diff --git a/src/input/base-input.js.flow b/src/input/base-input.js.flow index 38bfcb66f1..7a50622086 100644 --- a/src/input/base-input.js.flow +++ b/src/input/base-input.js.flow @@ -137,17 +137,13 @@ class BaseInput extends React.Compone }; onFocus = (e: SyntheticFocusEvent) => { - if (!this.props.readOnly) { - this.setState({ isFocused: true }); - this.props.onFocus(e); - } + this.setState({ isFocused: true }); + this.props.onFocus(e); }; onBlur = (e: SyntheticFocusEvent) => { - if (!this.props.readOnly) { - this.setState({ isFocused: false }); - this.props.onBlur(e); - } + this.setState({ isFocused: false }); + this.props.onBlur(e); }; getInputType() { diff --git a/src/input/base-input.tsx b/src/input/base-input.tsx index cbc2c538c5..4b1f6bf777 100644 --- a/src/input/base-input.tsx +++ b/src/input/base-input.tsx @@ -140,17 +140,13 @@ class BaseInput extends React. }; onFocus = (e: FocusEvent) => { - if (!this.props.readOnly) { - this.setState({ isFocused: true }); - this.props.onFocus(e); - } + this.setState({ isFocused: true }); + this.props.onFocus(e); }; onBlur = (e: FocusEvent) => { - if (!this.props.readOnly) { - this.setState({ isFocused: false }); - this.props.onBlur(e); - } + this.setState({ isFocused: false }); + this.props.onBlur(e); }; getInputType() { diff --git a/src/input/input.js.flow b/src/input/input.js.flow index 0b31a01855..f03eb872e9 100644 --- a/src/input/input.js.flow +++ b/src/input/input.js.flow @@ -36,21 +36,17 @@ class Input extends React.Component { * customers shouldn't have to manage themselves, such as input's focus state. */ state = { - isFocused: (this.props.autoFocus && !this.props.readOnly) || false, + isFocused: this.props.autoFocus || false, }; onFocus = (e: SyntheticFocusEvent) => { - if (!this.props.readOnly) { - this.setState({ isFocused: true }); - this.props.onFocus(e); - } + this.setState({ isFocused: true }); + this.props.onFocus(e); }; onBlur = (e: SyntheticFocusEvent) => { - if (!this.props.readOnly) { - this.setState({ isFocused: false }); - this.props.onBlur(e); - } + this.setState({ isFocused: false }); + this.props.onBlur(e); }; render() { diff --git a/src/input/input.tsx b/src/input/input.tsx index 954298300c..72142bd774 100644 --- a/src/input/input.tsx +++ b/src/input/input.tsx @@ -37,21 +37,17 @@ class Input extends React.Component { * customers shouldn't have to manage themselves, such as input's focus state. */ state = { - isFocused: (this.props.autoFocus && !this.props.readOnly) || false, + isFocused: this.props.autoFocus || false, }; onFocus = (e: FocusEvent) => { - if (!this.props.readOnly) { - this.setState({ isFocused: true }); - this.props.onFocus(e); - } + this.setState({ isFocused: true }); + this.props.onFocus(e); }; onBlur = (e: FocusEvent) => { - if (!this.props.readOnly) { - this.setState({ isFocused: false }); - this.props.onBlur(e); - } + this.setState({ isFocused: false }); + this.props.onBlur(e); }; render() { diff --git a/src/textarea/textarea.js.flow b/src/textarea/textarea.js.flow index 12e0160022..03eb5b6163 100644 --- a/src/textarea/textarea.js.flow +++ b/src/textarea/textarea.js.flow @@ -36,21 +36,17 @@ class Textarea extends React.Component { }; state = { - isFocused: (this.props.autoFocus && !this.props.readOnly) || false, + isFocused: this.props.autoFocus || false, }; onFocus = (e: SyntheticFocusEvent) => { - if (!this.props.readOnly) { - this.setState({ isFocused: true }); - this.props.onFocus(e); - } + this.setState({ isFocused: true }); + this.props.onFocus(e); }; onBlur = (e: SyntheticFocusEvent) => { - if (!this.props.readOnly) { - this.setState({ isFocused: false }); - this.props.onBlur(e); - } + this.setState({ isFocused: false }); + this.props.onBlur(e); }; render() { diff --git a/src/textarea/textarea.tsx b/src/textarea/textarea.tsx index 988b8fdf39..4f6c0f86e3 100644 --- a/src/textarea/textarea.tsx +++ b/src/textarea/textarea.tsx @@ -38,21 +38,17 @@ class Textarea extends React.Component< }; state = { - isFocused: (this.props.autoFocus && !this.props.readOnly) || false, + isFocused: this.props.autoFocus || false, }; onFocus = (e: FocusEvent) => { - if (!this.props.readOnly) { - this.setState({ isFocused: true }); - this.props.onFocus(e); - } + this.setState({ isFocused: true }); + this.props.onFocus(e); }; onBlur = (e: FocusEvent) => { - if (!this.props.readOnly) { - this.setState({ isFocused: false }); - this.props.onBlur(e); - } + this.setState({ isFocused: false }); + this.props.onBlur(e); }; render() {