Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

replace event.target to event.currentTarget #3380

Merged
merged 1 commit into from Jan 25, 2019

Conversation

DragorWW
Copy link
Contributor

@DragorWW DragorWW commented Jan 24, 2019

fix flow error in Select.js, related to #3350

The reason why you want to use event.currentTarget is that event.target may be the wrong element due to event propagation.
see more in:

flow types from react

declare class SyntheticEvent<+T: EventTarget = EventTarget, +E: Event = Event> {
  bubbles: boolean;
  cancelable: boolean;
  +currentTarget: T;
  defaultPrevented: boolean;
  eventPhase: number;
  isDefaultPrevented(): boolean;
  isPropagationStopped(): boolean;
  isTrusted: boolean;
  nativeEvent: E;
  preventDefault(): void;
  stopPropagation(): void;
  // This should not be `T`. Use `currentTarget` instead. See:
  // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682
  +target: EventTarget;
  timeStamp: number;
  type: string;
  persist(): void;
}

@gwyneplaine
Copy link
Collaborator

lgtm thanks @DragorWW

@gwyneplaine gwyneplaine merged commit 4686ea3 into JedWatson:master Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants