amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Impossible to override position of amp-user-notitifcation

Open kul3r4 opened this issue 10 years ago • 7 comments

The file: extensions/amp-user-notification/0.1/amp-user-notification.css specifies the position of the element as fixed using !important like this:

amp-user-notification { position: fixed !important;

Given in AMP is not possible to use !important, it is then impossible to override the position of this component.

kul3r4 avatar Feb 15 '16 21:02 kul3r4

/cc @erwinmombay

dvoytenko avatar Feb 15 '16 22:02 dvoytenko

It is not possible. This is because whether the component is shown depends on HTTP requests and so this can only be used with positions that are invariant to other page layout, to avoid impact on page flow when notification is shown.

You can e.g. put it at the bottom or some other place on the page.

cramforce avatar Feb 15 '16 22:02 cramforce

@kul3r4 this was a conscious decision. you can still manipulate top/left/right/bottom. i know we did say we were open to loosening the restriction but we'd need to hear a good argument for it.

erwinmombay avatar Feb 15 '16 23:02 erwinmombay

Ancestry.com: https://www.ancestry.com currently shows a cookie notice at the top of their site.

They have tried to implement the same using amp-user-notification but because it gets tagged on with "position: fixed!important", which ends up covering the logo and sign in at the top of the page which are both big CTAs.

Given they are using amp-user-notification with local storage (not remote checks) to decide whether or not to show the notification (not remotely configured), is there any way to override the "position: fixed!important", as without it, they won't be able to build this site to 100% parity?

Paging @erwinmombay

nainar avatar Mar 01 '19 19:03 nainar

Hello. Just pinging to see if there are any thoughts on this?

shishirm avatar Mar 14 '19 00:03 shishirm

@nainar AMP tries to avoid janking the page around. Other proposals that can show the notice without causing layout jank after first paint would be fine.

cramforce avatar Mar 14 '19 03:03 cramforce

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 04 '20 05:09 stale[bot]