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

Add close popup when click iframe for click trigger #96

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stephen-james
Copy link

Using Trigger with contextMenu supports closing on window blur, in order to cover when a user clicks/taps on an iframe, but when we use click as a trigger, this was previously not supported.

This fix modifies the handler to support both click and contextMenu as valid triggers.

  • simulates document click on window blur for both click and contextMenu triggers
  • contextMenuOutsideHandler1 renamed to contextMenuScrollOutsideHandler to be more descriptive about what case it is handling.
  • contextMenuOutsideHandler2 renamed to clickBlurOutsideHandler since it is the handler for click and contextMenu triggers (similar to clickOutsideHandler)

Using Trigger with `contextMenu` supports closing on window blur, in order to cover when a user clicks/taps on an iframe, but when we use `click` as a trigger, this was previously not supported.

This fix modifies the handler to support both click and contextMenu as valid triggers.

* simulates document click on window blur for both click and contextMenu triggers
* `contextMenuOutsideHandler1` renamed to `contextMenuScrollOutsideHandler` to be more descriptive about what case it is handling.
* `contextMenuOutsideHandler2` renamed to `clickBlurOutsideHandler` since it is the handler for click and contextMenu triggers (similar to `clickOutsideHandler`)
@coveralls
Copy link

Coverage Status

Coverage remained the same at 76.389% when pulling bcdf1ee on stephen-james:fix/close-popup-on-iframe-click into a619be2 on react-component:master.

currentDocument = currentDocument || props.getDocument();
this.contextMenuOutsideHandler1 = addEventListener(currentDocument,
this.contextMenuScrollOutsideHandler = addEventListener(currentDocument,
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for delay. contextMenuScrollOutsideHandler should get remove after unmounted. And also need a test case for this.

Copy link
Member

Choose a reason for hiding this comment

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

@evanyeung92
Copy link

I also encountered this issue, could this PR get merged?

@wonjunkang
Copy link

how can we trigger this in an iframe?

@nmaddp1995
Copy link

@zombieJ Can you please check on this. I have the same issue with iframe

@gy134340
Copy link

@zombieJ @afc163 the same, what's going on with this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants