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

FEATURE - Add useCapture config option #159

Merged
merged 4 commits into from Apr 16, 2019
Merged

Conversation

@richard-viney
Copy link
Collaborator

richard-viney commented Dec 14, 2018

This PR adds a useCapture option that causes event handlers in attach-popover.js to be run in the capturing phase rather than the bubbling phase. It is disabled by default, so the new behavior is opt-in.

The motivation for this is to work around problems where hideOn: click/clickout doesn't work when event propagation is stopped, e.g. when the user clicks out but the clicked target stops event propagation. In this case the popover won't be hidden when ember-attacher's event handlers are added in the bubbling phase.

Similarly for hideOn: click, where an element inside the popover can prevent the requested hiding behavior by stopping propagation in the bubbling phase.

This config option can be set to have popover event listeners added in the capturing phase instead of the bubbling phase.
@richard-viney

This comment has been minimized.

Copy link
Collaborator Author

richard-viney commented Dec 24, 2018

@kybishop Any feedback on this proposal?

@richard-viney

This comment has been minimized.

Copy link
Collaborator Author

richard-viney commented Jan 5, 2019

I've added a test for useCapture=true. Initially encountered what appeared to be a timing-related failure in an unrelated test, but re-running the test suite on CI didn't reproduce the issue and the tests all passed.

Do we need anything else before looking at merging this?

Thanks.

@richard-viney

This comment has been minimized.

Copy link
Collaborator Author

richard-viney commented Jan 27, 2019

@kybishop Any further feedback on this? Thanks.

@richard-viney

This comment has been minimized.

Copy link
Collaborator Author

richard-viney commented Apr 16, 2019

@luketheobscure If we could get this merged that would be great.

@luketheobscure luketheobscure merged commit f1e22b1 into kybishop:master Apr 16, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
urbany added a commit to urbany/ember-attacher that referenced this pull request Jun 7, 2019
FEATURE - Add useCapture config option

This config option can be set to have popover event listeners added in the capturing phase instead of the bubbling phase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.