Skip to content

Commit

Permalink
Fix composition on non-Chrome browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilander committed May 17, 2019
1 parent b37edfd commit 0d2ec0a
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ type State = {
ariaLiveContext: string,
inputIsHidden: boolean,
isFocused: boolean,
isComposing: boolean,
focusedOption: OptionType | null,
focusedValue: OptionType | null,
menuOptions: MenuOptions,
Expand All @@ -316,7 +315,6 @@ export default class Select extends Component<Props, State> {
focusedValue: null,
inputIsHidden: false,
isFocused: false,
isComposing: false,
menuOptions: { render: [], focusable: [] },
selectValue: [],
};
Expand All @@ -325,6 +323,7 @@ export default class Select extends Component<Props, State> {
// ------------------------------

blockOptionHover: boolean = false;
isComposing: boolean = false;
clearFocusValueOnUpdate: boolean = false;
commonProps: any; // TODO
components: SelectComponents;
Expand Down Expand Up @@ -984,14 +983,10 @@ export default class Select extends Component<Props, State> {
}
}
onCompositionStart = () => {
this.setState({
isComposing: true,
});
this.isComposing = true;
};
onCompositionEnd = () => {
this.setState({
isComposing: false,
});
this.isComposing = false;
};

// ==============================
Expand Down Expand Up @@ -1141,7 +1136,6 @@ export default class Select extends Component<Props, State> {
openMenuOnFocus,
} = this.props;
const {
isComposing,
focusedOption,
focusedValue,
selectValue,
Expand Down Expand Up @@ -1182,7 +1176,7 @@ export default class Select extends Component<Props, State> {
}
break;
case 'Tab':
if (isComposing) return;
if (this.isComposing) return;

if (
event.shiftKey ||
Expand All @@ -1205,7 +1199,7 @@ export default class Select extends Component<Props, State> {
}
if (menuIsOpen) {
if (!focusedOption) return;
if (isComposing) return;
if (this.isComposing) return;
this.selectOption(focusedOption);
break;
}
Expand Down

0 comments on commit 0d2ec0a

Please sign in to comment.