-
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow style
in noscript
#20609
Comments
I'd be OK with that, but with a low KB limit. It would only ever be a little additional styling, and a large noscript-stylesheet would weigh heavily on the default case. |
I thought content of |
I think allowing |
I think key would be to analyze the lifecycle including optimized AMP. The document can be
Ideally, these can be distinguished and devs can target the earliest stage that works for them to avoid e.g. re-layout once JS eventually loads. |
cc @alin04 since this may eventually intersect with the golang packager bug regarding noscript content parsing. |
FWIW this is valid html
|
Sorry. You said HTML, not AMPHTML. My mistake. |
Is there still interest in this request? I don't see a resolution to determine a final implementation plan and interest has died off, so for now I'll just close it and we can re-implement. |
(Accidentally hit submit before I finished.) |
Reopening since it has re-arisen as a need. I've been watching a Gutenberg issue for an Accordion block with the thought that it could be a good fit for the
The second two points are accounted for in If I disable JavaScript and go to https://preview.amp.dev/documentation/components/amp-accordion-v1.0.example.1.html the result is that the first two sections cannot be accessed. Seems like there's a need for Bento components (and classic components) to ship with For example: <noscript>
<style>
amp-accordion > section:not([expanded]) > :last-child {
display: block !important;
}
</style>
</noscript> See https://bento-amp-noscript-styles.glitch.me/
Instead of adding So going with So the boilerplate HTML the user should include (for Bento) would look like: <!-- AMP runtime script -->
<script async src="https://cdn.ampproject.org/v0.js"></script>
<!-- Bento component stylesheet -->
<link rel="stylesheet" type="text/css" href="https://cdn.ampproject.org/v0/amp-bento-component-name-1.0.css">
<!-- :sparkles: noscript Bento component stylesheet -->
<noscript>
<link rel="stylesheet" type="text/css" href="https://cdn.ampproject.org/v0/amp-bento-component-name-1.0-noscript.css">
</noscript>
<!-- Bento component script -->
<script async custom-element="amp-bento-component-name" src="https://cdn.ampproject.org/v0/amp-bento-component-name-1.0.js"></script> For the AMP case, AMP Optimizer should construct this So to start with at very least we need |
Allowing |
I think the only need is for For AMP pages, there is the similar existing Optimizer logic for the runtime CSS. The amphtml/validator/validator-css.protoascii Lines 1382 to 1404 in fb01d32
So I think the Optimizer transformer for component-specific Something else to consider is whether there should be a differentiation between user-authored noscript styles and component-specific noscript styles. Should there be separate |
In progress. cl/391926674 |
This is fixed and live everywhere. |
Confirmed! Given example document, the
Thank you! |
No problem. If you later discover that we need support for additional css rules for each extension as mentioned above, please open a new issue for that. |
As a few next steps I see, to open in other issues:
|
Summarizing conversations with @westonruter
It is common to have CSS rules to target
js
vsno-js
. Certain components need to become hidden or presented differently inno-js
case.Currently
html:not([amp-version])
is one workaround to set specificno-js
CSS rules. This works becausev0.js
adds that attribute but it is hacky and if SSR ever decides to add that attribute, it would break the workaround.Maybe the proper approach is allowing
style
innoscript
tag. I don't think it needs to fit the 50k limit either.@westonruter @Gregable @cramforce
The text was updated successfully, but these errors were encountered: