amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Amp-social-share doesn't open email agent on IOS

Open braraujo opened this issue 10 years ago • 11 comments

When using amp-social-share the email agent is not being opened on IPhone and IPOD 6 using Safari browser.

How do we reproduce the issue?

  1. Open the safari browser in an Iphone 5 or 6.
  2. Open the AMP page http://app.eltiempo.com/contenido/politica/partidos-politicos/ARTICULO-WEB-AMP-16624792.html
  3. Click in the email icon between gplus and whatsapp..
  4. It will open a blank screen and no email agents.

What browsers are affected?

Safari

All browsers? Some specific browser? What device type? IOS in an IPhone 5 and 6

Which AMP version is affected?

Powered by AMP ⚡ HTML – Version 1466794223483

Is this a new issue? Or was it always broken? Paste your AMP version. You can find it in the browser dev tools. Always broken. Powered by AMP ⚡ HTML – Version 1466794223483

braraujo avatar Jun 28 '16 13:06 braraujo

@mkhatib, were you the one testing target=_blank?

jridgewell avatar Jun 28 '16 18:06 jridgewell

Yes will take a look. I think we've seen this before but I remember we addressed it. Will check to see why this is no longer working.

Thanks for filing!

mkhatib avatar Jun 28 '16 18:06 mkhatib

I'm experiencing this same bug currently, any solutions?

riomyers avatar Aug 16 '16 16:08 riomyers

Hey guys! I figured out a cool solution for this, i used CSS to disable pointer-events on the email icon which stops the default behavior of opening a blank page on iOS and then wrapped the icon in an a tag with a mailto href set to display: inline-block and set to the exact same width and height as the icon so it overlaps it

You can see my example below, i hope it helps anyone else that runs into this problem :)

The CSS:

    .disable-icon{pointer-events: none;}
    .enable-icon{display:inline-block;width:60px;height:44px;} 

and the HTML:

<a href="mailto:[email protected]" class="enable-icon">
<amp-social-share type="email"
        class="disable-icon"
        width="60"
        height="44"></amp-social-share>
</a>

this method will still pass amp validation as there are no style attributes added directly to the amp element, it's all handled by adding the classes instead

riomyers avatar Aug 16 '16 17:08 riomyers

I was able to replicate this problem on Safari iOS only. Looking for a fix.

mkhatib avatar Aug 16 '16 17:08 mkhatib

My solution above should work :)

riomyers avatar Aug 16 '16 17:08 riomyers

@riomyers I am looking for a fix that works for the amp-social-share setup without the need to add the external anchor element.

Currently we shouldn't be doing anything special for the mailto: protocol, so we might need to include it in our custom protocol handling logic. Will test and report back.

mkhatib avatar Aug 16 '16 17:08 mkhatib

@mkhatib no worries at all! I understand that this is something that needs to be fixed internally, I was just offering a work around for the issue until it's been resolved, thanks! Look forward to your updates!

riomyers avatar Aug 16 '16 17:08 riomyers

@riomyers yeah I got that, thanks for the fix suggestion :-).

So, debugged this a bit, Safari iOS doesn't handle mailto: protocol very well when opened in _blank, we documented this in this article I published.

Just sent a PR for us to open the link in _self if it's a mailto: protocol.

mkhatib avatar Aug 16 '16 20:08 mkhatib

@mkhatib That's great!! thanks! Is there a way to set the email address the mailto link is supposed to send to? I couldn't find a way to specify this with the original social share email icon, it seemed to just open the default mail app with no specific recipient set.

riomyers avatar Aug 16 '16 20:08 riomyers

Yeah due to the fact that mailto: to is not a parameter like subject and body this isn't possible right now, mind opening an issue to track adding that to amp-social-share?

mkhatib avatar Aug 16 '16 22:08 mkhatib