Skip to content

Commit

Permalink
Fixed issue #9027 (#9042)
Browse files Browse the repository at this point in the history
  • Loading branch information
nareshbhatia authored and oliviertassinari committed Nov 8, 2017
1 parent d732bb1 commit 1a26a15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Form/FormControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ class FormControl extends React.Component<ProvidedProps & Props, State> {
};

handleBlur = event => {
if (this.props.onBlur) {
// The event might be undefined.
// For instance, a child component might call this hook
// when an input is disabled but still having the focus.
if (this.props.onBlur && event) {
this.props.onBlur(event);
}
if (this.state.focused) {
Expand Down
2 changes: 1 addition & 1 deletion src/Form/FormControl.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ describe('<FormControl />', () => {
const handleBlur = spy();
wrapper.setProps({ onBlur: handleBlur });
muiFormControlContext.onFocus();
muiFormControlContext.onBlur();
muiFormControlContext.onBlur({});
assert.strictEqual(handleBlur.callCount, 1);
});
});
Expand Down

0 comments on commit 1a26a15

Please sign in to comment.