Problem/Motivation

When Shariff is used on page that has Twitter integration (fe. module: Media entity Twitter [media_entity_twitter]) and when we click on twitter Shariff button, two pup-up windows appear.

Problem comes from twitter widget.js (//platform.twitter.com/widgets.js) script, it simply handles click on link and in case of tweet link, it will pop-up window with tweet (here is link to example). Here is twitter documentation for integration and looks like, it's not possible to mark link to be ignored by twitter widget.

Proposed resolution

Possible solution is to stop click event propagation outside Shariff Block and then twitter widget click even handler will not be executed.

Remaining tasks

  1. Add behaviour that will register click handler to stop propagation outside Shariff Block.

Comments

mtodor created an issue. See original summary.

mtodor’s picture

Status: Active » Needs review
StatusFileSize
new3.15 KB

Here is proposed solution.

nebel54’s picture

Thanks for the patch, but I would prefer to get this problem handled directly in the Shariff library directly, as it is not a drupal specific problem. I added a pull request here: https://github.com/heiseonline/shariff/pull/201.

Let's see if we can find a solution over there, otherwise we should apply your patch and extend it to make it work outside of the shariff block.

mtodor’s picture

StatusFileSize
new3.28 KB
new1.9 KB

Since Shariff library is released (1.25.1) -> shariff.complete.js file does not exist anymore. So this patch has to be adjusted to use shariff.min.js instead of shariff.complete.js.

@Nebel54 In my opinion this issue is related to integration of Shariff library, that's why I'm not sure it should be handled in library itself. In short: if someone integrates shariff lib and twitter lib on same page, they have to take care of it. If we argue that shariff lib should handle it, then we can also argue that twitter lib should handle it. ;)

  • mtodor authored 8f15043 on 8.x-1.x
    Issue #2845000 by mtodor: Two twitter pop-up windows appear on page with...
nebel54’s picture

Status: Needs review » Fixed

Agreed. Thanks for the patch! Its commited.

mtodor’s picture

There is one problem, there is not new release of Shariff library. :(
Here is issue on Shariff library github: https://github.com/heiseonline/shariff/issues/217

But asset packagist displays it (both bower and npm):
https://asset-packagist.org/package/search?query=npm-asset%2Fshariff

nebel54’s picture

Urgs... But it seems like they are working on a release. Maybe my pull request will become part of the next version :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.