-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Reactdevtools -----> Modal deleting filter fix #22481
Conversation
@@ -239,7 +239,7 @@ export function useModalDismissSignal( | |||
ownerDocument = ((modalRef.current: any): HTMLDivElement).ownerDocument; | |||
ownerDocument.addEventListener('keydown', handleDocumentKeyDown); | |||
if (dismissOnClickOutside) { | |||
ownerDocument.addEventListener('click', handleDocumentClick); | |||
ownerDocument.addEventListener('click', handleDocumentClick, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add this param to the removeEventListener
call below too:
ownerDocument.removeEventListener('click', handleDocumentClick, true);
Messed up will pull another one ! |
ownerDocument.addEventListener('click', handleDocumentClick, true); | ||
ownerDocument.addEventListener('click', handleDocumentClick); | ||
ownerDocument.removeEventListener('click', handleDocumentClick,true); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry. This is not what I meant.
We add event listeners in the effects body and we remove them in the cleanup function the effect returns.
We need to add the new useCapture
param to both places not just addEventListener
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ownerDocument.addEventListener('click', handleDocumentClick, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok @bvaughn i closed this one as i messed up the repo will be pulling another pr now
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
whats the problem?
As you can see in below when we try to delete the last filter index , it closes the whole modal but rather it should just delete the last filter this PR fixes this issue
Fixed-