Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm committed Oct 14, 2020
1 parent 80f695d commit 4e70062
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 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,15 @@ 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 === 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

0 comments on commit 4e70062

Please sign in to comment.