Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Using onInput on IE11 and onChange on all other browsers #4

Merged
merged 1 commit into from
May 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/FancyField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@ import classnames from 'classnames';
import immutable, {fromJS} from 'immutable';

const fromTypeahead = 'FROM_TYPEAHEAD';
const isIE11 = !(window.ActiveXObject) && "ActiveXObject" in window;

function isImmutable(obj) {
return obj !== null && typeof obj === "object" && !!obj.toJSON;
}

function getInputOnChangeProps(handler) {
return isIE11 ? { onInput: handler } : { onChange: handler };
}

export default React.createClass({
listEl: null,
fancyFieldEl: null,
Expand Down Expand Up @@ -394,6 +399,7 @@ export default React.createClass({
aria-invalid={shouldShowError}
ref={(el) => this.fancyFieldEl = el}
placeholder={placeholder}
{...getInputOnChangeProps(this.handleChange)}
onChange={this.handleChange}
onBlur={this.handleBlur}
onFocus={this.handleFocus}
Expand Down