-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃枍 Fix rendering of noscript fallbacks in optimized AMP pages #29846
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue was specificity. I'm happy with whatever targets noscript
directly, instead of not(noscript)
.
Co-authored-by: Weston Ruter <westonruter@google.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks all for finding a path forward.
I noticed when looking at an optimized AMP page with images that the
noscript
fallbacks 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-img
with anoscript
fallback:The
noscript
is hidden by this CSS rule:This PR excludes
noscript
elements 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 withfill
layout to behave similarly to shadow DOM contents constructed with JS.