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

Stop propagation is impossible to use in conjunction with this #48

Open
tandrewnichols opened this issue Jun 7, 2018 · 0 comments
Open

Comments

@tandrewnichols
Copy link

Because of these lines in good-listener which is what clipboard.js uses for listening to clicks, specifically because it uses event delegation and listens on body, it's consequently impossible to use this directive inside anything that needs to stop propagation because then the click is never triggered on body. For instance, my use case (simplified) is like this:

<div class="container" ng-click="open = !open">
  <div class="row-header">
    <!-- Header content -->
  </div>
  <div class="body-content animate-show" ng-show="open" stop-propagation>
    <span ngclipboard data-clipboard-text="This will never be copied" ngclipboard-success="doSomething()">Copy</span>
  </div>
</div>

Obviously, that's contrived, cause here you could easily move the ng-click further down, but the point it illustrates can't always be worked around. I mean, if any parent, anywhere on the page above ngclipboard calls stopPropagation, the text will never be copied.

There's an issue on clipboard.js related to this here, but I don't see how the proposed solution there could be implemented using this directive.

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

No branches or pull requests

1 participant