Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amp-sidebar: Does it absolutely have to be the child of the body? Why?

Tags:

html

amp-html

Why does <amp-sidebar> HAVE to be the direct child of the body?

I am in a situation where, in terms of code structure, it would be much easier for me to include <amp-sidebar> within a <div>. I want it to behave exactly like <amp-sidebar>, but I simply don't have any easy way to place an element as the direct child of a <body>.

I was especially confused when I saw that this amp-by-example page does not pass the AMP validator.

Could someone please illuminate me? I thought about opening an issue on github, but I'm not sure if there's a bug.

like image 382
user2761669 Avatar asked Oct 30 '22 19:10

user2761669


1 Answers

According to a lead dev of the AMP project, the requirement that <amp-sidebar> is child of <body> is due to a Safari bug with position:fixed. Link to tweet.

like image 166
Ksenia Avatar answered Nov 15 '22 05:11

Ksenia