🖍 Fix rendering of noscript fallbacks in optimized AMP pages#29846
🖍 Fix rendering of noscript fallbacks in optimized AMP pages#29846kristoferbaxter merged 5 commits intoampproject:masterfrom
Conversation
8201359 to
fa5f23a
Compare
|
@alanorozco I've amended this PR to also address the problem of the I've put together a more detailed example comparing the same For another example of how the lack of this being in |
|
Issue also reported on the support forums: https://wordpress.org/support/topic/images-cannot-be-displayed-without-javascript-despite-noscript-tags/ |
|
This issue came up yet again on Slack. @alanorozco Could you review please? |
|
This change causes a test failure. Investigating. |
|
This PR appears to break a set of tests related to expected errors for |
css/ampshared.css
Outdated
| z-index: 2; | ||
| } | ||
|
|
||
| noscript { |
There was a problem hiding this comment.
Technically this should only be targeting noscript elements that are children of AMP elements, but at the very least it should be restricted to the body:
| noscript { | |
| body noscript { |
There was a problem hiding this comment.
This issue was specificity. I'm happy with whatever targets noscript directly, instead of not(noscript).
Co-authored-by: Weston Ruter <westonruter@google.com>
kristoferbaxter
left a comment
There was a problem hiding this comment.
Thanks all for finding a path forward.

I noticed when looking at an optimized AMP page with images that the
noscriptfallbacks do not render when JavaScript is turned off in the browser. This doesn't occur in unoptimized AMP because the.i-amphtml-*class names are not not present in the document.For example, in this optimized
amp-imgwith anoscriptfallback:The
noscriptis hidden by this CSS rule:This PR excludes
noscriptelements from being hidden on optimized AMP pages.Granted, the styling is broken here for the fallbacknoscript > img, but at least it is rendered.Update: It also ensures that
noscript > *fallback elements get displayed withfilllayout to behave similarly to shadow DOM contents constructed with JS.