Socialite icon indicating copy to clipboard operation
Socialite copied to clipboard

Duplicate Twitter buttons

Open diniscorreia opened this issue 9 years ago • 15 comments

Twitter buttons are now being duplicated (actually, it looks like it creates and additional button for any other tweet button on the page).

Even the project's home page is showing the problem (two tweet buttons appear under Demo).

Probably some change on Twitter's end?

diniscorreia avatar Aug 12 '15 23:08 diniscorreia

And in some cases the buttons are tripled.

osvaldasvalutis avatar Aug 13 '15 06:08 osvaldasvalutis

The same story with me

joneslloyd avatar Aug 13 '15 07:08 joneslloyd

Same problem here.

~~Everything works fine if I remove this line inside twitterInit, which seems to create a second anchor element.~~ ~~In fact, the whole twitterInit function appears to be useless now. Maybe it's just a deprecated workaround?~~

Update: that's not it. But it unexpectedly worked fine for a couple of times.

Update2: it worked only because I used my browser debugger and stopped the script execution. Even without changing any code, this "fixes" the problem, therefore I'd assume it's some kind of race condition during the Twitter script loading. Maybe it's loaded/bound twice?

Update3: if I comment everything inside twitterActivate, it works fine. Maybe twitter is now calling window.twttr.widgets.load(); automatically by default?

alexcasalboni avatar Aug 13 '15 08:08 alexcasalboni

Hmm, that doesn't seem to be working for me.

joneslloyd avatar Aug 13 '15 08:08 joneslloyd

@joneslloyd sorry, I updated my comment.

I'm fixing it on my side by removing/commenting twitterActivate, for now. My hypothesis is that Twitter is now binding the widgets automatically, and therefore calling window.twttr.widgets.load(); is not required anymore.

I'll be waiting for a more official fix.

alexcasalboni avatar Aug 13 '15 08:08 alexcasalboni

@alexcasalboni Thanks! Is that along with the whole twitterInit function removed?

I'll try this and see if it solves it :)

joneslloyd avatar Aug 13 '15 08:08 joneslloyd

@joneslloyd no, twitterInit is still required otherwise the widget won't show up at all.

alexcasalboni avatar Aug 13 '15 08:08 alexcasalboni

I see, thank you.

That's actually not working for me. Now I'm getting the other social networks loading, and the unstyled ahref text of the Twitter share button (without it loading into the twitter share button).

joneslloyd avatar Aug 13 '15 08:08 joneslloyd

Yep, I ended up removing window.twttr.widgets.load(); to fix it. I suspect the same, it's probably being loaded automatically. Not sure if the Twitter docs changed, but right now it only mentions twttr.widgets.load() when new content is appended to the DOM.

diniscorreia avatar Aug 13 '15 11:08 diniscorreia

@diniscorreia Can you provide a live link to the issue on your site? Unfortunately not seeing the issue, even on the homepage.

Here is what I am seeing: 2015-08-13_0710

tmort avatar Aug 13 '15 11:08 tmort

@tmort maybe you have a cached version of the Twitter JS in your browser. I can see two Twitter buttons on the homepage as well.

socialite-bug

alexcasalboni avatar Aug 13 '15 11:08 alexcasalboni

@alexcasalboni Got it. Will check out when I'm in the office later today. @diniscorreia I'll give your fix a try first - if that is the solution I'll have an update ASAP.

Thanks to all of you for creating the thread and catching this.

tmort avatar Aug 13 '15 11:08 tmort

@tmort any update on this? Do you think our current hotfix might create problems? I mean, if Twitter decides to rollback this update, no widgets will show up at all. Can you think of any better workaround to handle both cases?

alexcasalboni avatar Aug 14 '15 10:08 alexcasalboni

@alexcasalboni not the best solution, but if you need a quick workaround that doesn't mess with the plugin, you can just use CSS to hide all the iframes inside that element except for the first child.

diniscorreia avatar Aug 14 '15 11:08 diniscorreia

Please assign this issue to me

Kedarnath-Rothe avatar Oct 23 '23 04:10 Kedarnath-Rothe