Skip to content

Commit

Permalink
Merge pull request #3432 from JedWatson/fix-mobile-regression
Browse files Browse the repository at this point in the history
changed event.currentTarget back to event.target for ontouchEnd logic
  • Loading branch information
gwyneplaine authored Feb 18, 2019
2 parents 3f248f9 + 6a7cc4c commit a23e9cd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -1019,11 +1019,13 @@ export default class Select extends Component<Props, State> {
if (this.userIsDragging) return;

// close the menu if the user taps outside
// we're checking on event.target here instead of event.currentTarget, because we want to assert information
// on events on child elements, not the document (which we've attached this handler to).
if (
this.controlRef &&
!this.controlRef.contains(event.currentTarget) &&
!this.controlRef.contains(event.target) &&
this.menuListRef &&
!this.menuListRef.contains(event.currentTarget)
!this.menuListRef.contains(event.target)
) {
this.blurInput();
}
Expand All @@ -1034,7 +1036,6 @@ export default class Select extends Component<Props, State> {
};
onControlTouchEnd = (event: SyntheticTouchEvent<HTMLElement>) => {
if (this.userIsDragging) return;

this.onControlMouseDown(event);
};
onClearIndicatorTouchEnd = (event: SyntheticTouchEvent<HTMLElement>) => {
Expand Down

0 comments on commit a23e9cd

Please sign in to comment.