-
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
🖍 Cleanup several unresolved amp-layout CSS states #28115
Conversation
@@ -237,7 +239,8 @@ i-amphtml-sizer { | |||
|
|||
/* Hide all children of non-container elements. */ | |||
.i-amphtml-notbuilt:not(.i-amphtml-layout-container) > * , | |||
[layout]:not([layout=container]):not(.i-amphtml-element) > * | |||
[layout]:not([layout=container]):not(.i-amphtml-element) > *, |
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.
I realized this also doesn't account for implicit container layout. Is there even a CSS selector that would match?
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.
What defines implicit container? Is it just a lack of width
and height
and layout
?
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.
Lines 429 to 442 in 67815dc
// Calculate effective layout. | |
if (inputLayout) { | |
layout = inputLayout; | |
} else if (!width && !height) { | |
layout = Layout.CONTAINER; | |
} else if (height == 'fluid') { | |
layout = Layout.FLUID; | |
} else if (height && (!width || width == 'auto')) { | |
layout = Layout.FIXED_HEIGHT; | |
} else if (height && width && (sizesAttr || heightsAttr)) { | |
layout = Layout.RESPONSIVE; | |
} else { | |
layout = Layout.FIXED; | |
} |
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.
I don't believe we can do this without :not(:resolved)
- Adds unresolved layout for `intrinsic` styles - Fixes specificity for unresolved `fixed-height` styles - Adds unresolved implicit layout `responsive` styles
Need a bundle size approval. |
[layout]:not(.i-amphtml-element) | ||
[layout]:not(.i-amphtml-element), | ||
[width][height][sizes]:not([layout]):not(.i-amphtml-element), | ||
[width][height][heights]:not([layout]):not(.i-amphtml-element) |
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.
Please add a comment that this [width][height][sizes]
and [width][height][heights]
are "implicit responsive" here and below. Follow-up PR is cool too to avoid the bundle size reapproval.
[layout]:not(.i-amphtml-element) | ||
[layout]:not(.i-amphtml-element), | ||
[width][height][sizes]:not([layout]):not(.i-amphtml-element), | ||
[width][height][heights]:not([layout]):not(.i-amphtml-element) |
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.
We're not handling any of the other implicit layouts either. Not sure if it's better to only fix this for implicit responsive or leave them all unfixed.
Consider leaving a note/TODO about this at least.
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.
fixed
, fixed-height
, fluid
and container
are the missing ones. fluid
isn't documented on https://amp.dev/documentation/guides-and-tutorials/learn/amp-html-layout/#layout, so lets ignore it.
fixed
and fixed-height
are implicit based on height
and width
only. Unfortunately, that's very generic, and there are non-amp elmeents that fit that:
- width + height
- amp-script > canvas
- SVG > *
- td
- th
- input
- width
- table
And container
conflicts with basically everything.
I'm not sure we want to apply these styles to those elements.
I'll add a comment.
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.
Ok, thanks for looking into it.
* Cleanup several unresolved amp-layout CSS states - Adds unresolved layout for `intrinsic` styles - Fixes specificity for unresolved `fixed-height` styles - Adds unresolved implicit layout `responsive` styles * Fix fixed-height selector * Add in implicit responsive with heights
intrinsic
stylesfixed-height
stylesresponsive
styles