Skip to content

Commit

Permalink
Remove inputRef.blur() call that was causing a focus trap in Safari/IE
Browse files Browse the repository at this point in the history
  • Loading branch information
majapw committed Jun 18, 2018
1 parent 0c7d9af commit 8416bc9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/components/DateInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ class DateInput extends React.Component {

if (focused && isFocused) {
this.inputRef.focus();
} else {
this.inputRef.blur();
}
}

Expand Down
17 changes: 0 additions & 17 deletions test/components/DateInput_spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,10 @@ describe('DateInput', () => {

describe('focus/isFocused', () => {
const el = {
blur() {},
focus() {},
};

beforeEach(() => {
sinon.spy(el, 'blur');
sinon.spy(el, 'focus');
});

Expand All @@ -252,23 +250,8 @@ describe('DateInput', () => {

wrapper.setProps({ focused: true, isFocused: true });

expect(el.blur).to.have.property('callCount', 0);
expect(el.focus).to.have.property('callCount', 1);
});

it('blurs when becoming unfocused', () => {
const wrapper = shallow(
<DateInput id="date" focused isFocused />,
{ disableLifecycleMethods: false },
).dive();

wrapper.instance().inputRef = el;

wrapper.setProps({ focused: false, isFocused: false });

expect(el.blur).to.have.property('callCount', 1);
expect(el.focus).to.have.property('callCount', 0);
});
});

/*
Expand Down

0 comments on commit 8416bc9

Please sign in to comment.