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

Reactdevtools -----> Modal deleting filter fix #22481

Closed
wants to merge 3 commits into from
Closed

Reactdevtools -----> Modal deleting filter fix #22481

wants to merge 3 commits into from

Conversation

Biki-das
Copy link
Contributor

@Biki-das Biki-das commented Oct 1, 2021

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
127568480-5210f281-2f37-4388-baf3-ac81008cd8eb

Fixed-
127568697-12c28e3e-bf43-47dd-ac69-8b88457b01b3

@Biki-das Biki-das changed the title modal closing deleting fix Reactdevtools -----> Modal deleting item fix Oct 1, 2021
@Biki-das Biki-das changed the title Reactdevtools -----> Modal deleting item fix Reactdevtools -----> Modal deleting filter fix Oct 1, 2021
@@ -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);
Copy link
Contributor

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);

@Biki-das Biki-das closed this Oct 1, 2021
@Biki-das
Copy link
Contributor Author

Biki-das commented Oct 1, 2021

Messed up will pull another one !

@Biki-das Biki-das deleted the work branch October 1, 2021 17:50
ownerDocument.addEventListener('click', handleDocumentClick, true);
ownerDocument.addEventListener('click', handleDocumentClick);
ownerDocument.removeEventListener('click', handleDocumentClick,true);

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ownerDocument.addEventListener('click', handleDocumentClick, true);

Copy link
Contributor Author

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

bvaughn added a commit that referenced this pull request Oct 2, 2021
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
zhengjitf pushed a commit to zhengjitf/react that referenced this pull request Apr 15, 2022
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants