amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

[amp-viewer]Fixed/sticky elements have layout issues inside amp-viewer.

Open xiaotong-kk9 opened this issue 7 years ago • 2 comments

What's the issue?

Fixed/sticky elements have layout issues.

How do we reproduce the issue?

Fixed elements: (Mobile Browser: Chrome 75.0.3770.85 iOS 12.1.2)

  1. Visit amp page link and amp viewer link
  2. Inside amp-viewer, the header of the page is covered by viewer header. It should be displayed below the viewer header.

1643699

Sticky elements: (Desktop browser: Chrome 75.0.3770.90 Mac 10.14.5)

  1. Visit amp page link and amp viewer link
  2. Please scroll down the page inside amp-viewer. The sticky element (header.ap--header) moves out of the viewport.

AMP page screenshot: Screen Shot 2019-06-19 at 12 22 32 PM

AMP page inside amp-viewer screenshot: Screen Shot 2019-06-19 at 12 22 37 PM

Which AMP version is affected?

1906141418310

xiaotong-kk9 avatar Jun 19 '19 04:06 xiaotong-kk9

@jridgewell Hey Justin, not sure if you are the right one to ask :) Since fixed and sticky elements can not display perfectly as intended, what is the best solution/workaround to implement a sticky header?

xiaotong-kk9 avatar Jun 19 '19 04:06 xiaotong-kk9

You need to set a top: 0 style on the element that is actually position: fixed. In your case, it should be on the div.header_main element, not the header element.

jridgewell avatar Jun 19 '19 19:06 jridgewell