Skip to content

Commit

Permalink
fix: don't compare native event types with react event types
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Aug 8, 2020
1 parent 0e98446 commit ff641a5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/react-dom/src/events/DOMPluginEventSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ export function accumulateSinglePhaseListeners(

let instance = targetFiber;
let lastHostComponent = null;
const targetType = event.type;
const targetType = event.nativeEvent.type;

// Accumulate all instances and listeners via the target -> root path.
while (instance !== null) {
Expand Down
1 change: 1 addition & 0 deletions packages/react-dom/src/events/ReactSyntheticEventType.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type ReactSyntheticEvent = {|
_dispatchListeners?: null | Array<Function> | Function,
_reactName: string,
_targetInst: Fiber,
nativeEvent: Event,
type: string,
currentTarget: null | EventTarget,
|};
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ export function useFocus(
const stateRef = useRef<null | {isFocused: boolean, isFocusVisible: boolean}>(
{isFocused: false, isFocusVisible: false},
);
const focusHandle = useEvent('focus', passiveObjectWithPriority);
const blurHandle = useEvent('blur', passiveObjectWithPriority);
const focusHandle = useEvent('focusin', passiveObjectWithPriority);
const blurHandle = useEvent('focusout', passiveObjectWithPriority);
const focusVisibleHandles = useFocusVisibleInputHandles();

useLayoutEffect(() => {
Expand Down Expand Up @@ -297,8 +297,8 @@ export function useFocusWithin<T>(
const stateRef = useRef<null | {isFocused: boolean, isFocusVisible: boolean}>(
{isFocused: false, isFocusVisible: false},
);
const focusHandle = useEvent('focus', passiveObjectWithPriority);
const blurHandle = useEvent('blur', passiveObjectWithPriority);
const focusHandle = useEvent('focusin', passiveObjectWithPriority);
const blurHandle = useEvent('focusout', passiveObjectWithPriority);
const afterBlurHandle = useEvent('afterblur', passiveObject);
const beforeBlurHandle = useEvent('beforeblur', passiveObject);
const focusVisibleHandles = useFocusVisibleInputHandles();
Expand Down

0 comments on commit ff641a5

Please sign in to comment.