Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
Address feedback
  • Loading branch information
trueadm committed Oct 14, 2020
1 parent 80f695d commit 000b0fe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
15 changes: 9 additions & 6 deletions packages/react-dom/src/events/DOMPluginEventSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -747,13 +747,16 @@ export function accumulateSinglePhaseListeners(
// this out by checking if intercept fiber set on the event matches the
// current instance fiber. In which case, we should clear all existing
// listeners.
if (
enableCreateEventHandleAPI &&
nativeEvent.type === 'beforeblur' &&
if (enableCreateEventHandleAPI && nativeEvent.type === 'beforeblur') {
// $FlowFixMe: internal field
nativeEvent._detachedInterceptFiber === instance
) {
listeners = [];
const detachedInterceptFiber = nativeEvent._detachedInterceptFiber;
if (
detachedInterceptFiber !== null &&
(detachedInterceptFiber === instance ||
detachedInterceptFiber === instance.alternate)
) {
listeners = [];
}
}
instance = instance.return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2425,7 +2425,7 @@ describe('DOMPluginEventSystem', () => {
});

// @gate experimental
it('beforeblur has the correct propagation mechancis after a nested focused element is unmounted', () => {
it('beforeblur should skip handlers from a deleted subtree after the focused element is unmounted', () => {
const onBeforeBlur = jest.fn();
const innerRef = React.createRef();
const innerRef2 = React.createRef();
Expand Down Expand Up @@ -2565,7 +2565,7 @@ describe('DOMPluginEventSystem', () => {
});

// @gate experimental
it('beforeblur has the correct propagation mechancis after a nested focused element is suspended', () => {
it('beforeblur should skip handlers from a deleted subtree after the focused element is suspended', () => {
const onBeforeBlur = jest.fn();
const innerRef = React.createRef();
const innerRef2 = React.createRef();
Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberWorkLoop.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -2172,7 +2172,7 @@ function commitBeforeMutationEffectsImpl(fiber: Fiber) {
doesFiberContain(fiber, focusedInstanceHandle)
) {
shouldFireAfterActiveInstanceBlur = true;
beforeActiveInstanceBlur(current);
beforeActiveInstanceBlur(fiber);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberWorkLoop.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -2271,7 +2271,7 @@ function commitBeforeMutationEffects() {
doesFiberContain(nextEffect, focusedInstanceHandle)
) {
shouldFireAfterActiveInstanceBlur = true;
beforeActiveInstanceBlur(current);
beforeActiveInstanceBlur(nextEffect);
}
}
}
Expand Down

0 comments on commit 000b0fe

Please sign in to comment.