amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Story layout from iMessage to Chrome on iPhone seems broken

Open shishirm opened this issue 6 years ago • 4 comments

What's the issue?

When clicking on an iMessage/Whatsapp Story URL on an iPhone with the default browser set to Chrome, this Story seems to open with the content shifted down. Please see attached video. I've been able to reproduce on some URLs but not others.

For example, I'm seeing this behavior with this URL -> https://stori.es/Dy9Rd Not seeing the behavior with this URL -> https://www.pcgamesn.com/web-stories/games-like-stardew-valley.html

How do we reproduce the issue?

  1. Make sure Chrome is the default browser on your iOS device
  2. Click on a stories link from within either iMessage or Whatsapp
  3. The Story which opens in Chrome has its content shifted down. The Story viewer artifacts like the share button are still in the right place.
  4. Refreshing the Story causes the viewer to fix itself and the content is moved back up to the right place.
  5. If I click on the address bar and then click back out then the layout seems to appear correctly.

story_layout_chrome_ios

What browsers are affected?

Chrome on iOS when clicking into from another app. Does not happen when the Story is loaded directly from the address bar.

Which AMP version is affected?

Observed recently. Not sure if persistent from earlier versions of AMP.

shishirm avatar Oct 30 '20 21:10 shishirm

@ampproject/wg-stories

Enriqe avatar Oct 30 '20 21:10 Enriqe

My personal experience with this issue leads me to believe there is either a bug with iOS Chrome spawning a new tab and trying to load a URL automatically --and/or-- the AMP Player not handling this "automatic new tab" correctly. This "automatically-loading new tab" occurs when clicking a Web Story link from another app (that results in iOS Chrome becoming the foreground app and opening a new tab), or while already in iOS Chrome and clicking a link on a page that opens in a new tab (e.g. href tags with target=_blank).

It also appears to me that this auto new tab is permanently "tainted" in that it will never render the story correctly on it's own, even on page refresh. The only two things that seem to make a difference are:

  1. While observing the problem in a "tainted" new tab, tap the address bar (revealing the full address bar UI), and then click cancel to hide the UI. Notice the story is now rendered correctly.
  2. Manually open a new tab in iOS Chrome and then paste the direct Web Story URL in to the address bar. Notice the story is rendered correctly.

Observe the problem in this example:

  1. Go to this link in iOS Chrome: https://amp.dev/about/stories/
  2. Scroll down to the example stories.
  3. Tap the "CNN Antarctic" story (first one on the left).
  4. It should spawn a new tab and load the story - notice the text being cut off at the bottom by iOS Chrome's UI
  5. Even refreshing the page does not cause rendering to happen correctly.

Now, if you follow these steps, the same story will load and be rendered correctly:

  1. Copy the direct link to the CNN story. https://edition-cnn-com.cdn.ampproject.org/c/s/edition.cnn.com/ampstories/world/protecting-the-antarctic-a-journey-to-a-continent-in-distress
  2. Manually open a new tab in iOS Chrome. Past the CNN story URL in to the browser and load the story
  3. Notice the story is rendered correctly.

I've also attached a video showing shishirm's example story showing the behavior I've outlined. https://user-images.githubusercontent.com/879860/110242156-c5dad280-7f22-11eb-97d1-65bb9dffc2fd.MP4

In the video, you'll see that I click the link in the Github issue, which spawns a new tab with the story loaded automatically. The story exhibits the issue. I reloaded the story 3 times with no change. Then, open and then close the address bar, after which you can see the story is now rendered differently.

More puzzling is that in the final step, I open the hamburger menu on the right and the story is rendered differently again.

rickygrows avatar Mar 07 '21 13:03 rickygrows

Did some debugging (following the steps in https://github.com/ampproject/amphtml/issues/30935#issuecomment-792283139), and it seems the issue is the browser is giving the wrong viewport dimensions.

We use height: 100% for <amp-story> as well as <amp-story-page> and <amp-story-grid-layer>, which should fill the entire viewport to fit the content's size. The first element in the child root path that sets the height of the parent elements is the <amp-img>, which uses layout=fill and covers the entire viewport. (position: absolute; left: 0; top: 0; bottom: 0...). This suggests that the browser is giving an incorrect size.

image Tested on iOS Chrome version 87 (which was released 3 months ago).

The good news is that I tested with newer versions of Chromium and I'm not able to repro the fix. I've filed an issue with the Chromium team to follow up on this.

Enriqe avatar Mar 17 '21 00:03 Enriqe

Someone commented on the Chromium issue that it is probably an issue with Chrome 87. I remember the first time we noticed this issue, we only had it on Chrome beta but not prod. Then it made its way into prod.

Closing as it appears to be a browser bug that is already resolved and rolling out to users. Thank you for the investigation @Enriqe.

gmajoulet avatar Mar 25 '21 15:03 gmajoulet