Possibly removing the '!important' rule from .i-amphtml-layout-size-defined class?
What's the issue?
When using the amp-list component, the added .i-amphtml-layout-size-defined class has a property of overflow: hidden!important;
In order to override this style, I would need to use the !important rule as well, and as a result the AMP page would be invalid.
How do we reproduce the issue?
I have a video showing this issue: https://www.useloom.com/share/f8d91753d79d433cb3dfabeeb0a0e38f
What browsers are affected?
All browsers.
Which AMP version is affected?
Version 1506372648650
/cc @aghassemi Ali, do you know if there's a workaround for this issue where the footer has a fixed height and cannot accommodate accordions well?
The root-cause of the problem is that amp-list does not resize if something inside of it changes height.
@dvoytenko I am evaluating whether supporting layout=container for amp-list makes sense, I can't think of any issues with supporting it, do you know why container layout has been disallowed?
The overflow:hidden is there explicitly to disallow UX-breaking resizes after the initial render. We typically allow such resizes closer to the bottom of the page, however. But the whole idea of amp-list is that resize is vetoable. E.g. see overflow
Now, that particular use case seems to involve user action. I think we can do something about allowing safer resizes when user action is involved since user action is a good enough indicator that UX will change.
@aghassemi @choumx WDYT?
@dvoytenko I was thinking to just allow layout=container for amp-list, I can't find a reason against it, do you know why it was disallowed initially?
Adding a high-trust "resize" action on amp-list seems reasonable. There have been a few related issues: #5686, #9424, #11251
I can't find a reason against it, do you know why it was disallowed initially?
Load page -> scroll past an amp-list -> start reading stuff -> stuff you're reading disappears due to amp-list resize.
oh amp-list does attemptChangeHeight, I wrongly thought it is doing changeHeight after render.
Ideally we can automate this, maybe we can capture all click events inside amp-listand rerun the resize logic? this should handle vast majority of cases
Also given setState is high-trust, I assume we can make the second+ loads that are resulted from mutation of src to do force change height?
My preference as well. Here's how I see it.
- We catch all
click. We do it already anyway, e.g. in Action service. - We mark the click target and/or action target as "user gesture activated" with timestamp.
- Whenever we are trying to execute any action with "high trust", e.g. resize, we look if the element is contained inside a container with user gesture activated and unexpected timestamp.
WDYT?
I think it makes sense to allow opt-out (or require opt-in) to automatic resizing. Perhaps a new boolean attribute, e.g. <amp-list auto-resize>?
I assume we can make the second+ loads that are resulted from mutation of src to do force change height?
Yep, an example here: https://github.com/ampproject/amphtml/issues/10230#issuecomment-314827209
I was hoping user does not need to explicitly trigger resize action on amp-list. e.g. 1- amp-list listens for click inside itself, schedules a check height -> maybe resize task. 2- If src is changed via mutation, it always forces height change (since it assumed src was changed via a high-trust action)
@choumx I vote for opt-out
Opt in/out. Why would an amp-list ever want to opt-out?
Opt-in will avoid introducing unexpected UX changes to prod pages.
I imagine most amp-list usages today have static size and an inadvertent tap could cause strange content jumping. E.g. amp-list elements without amp-accordion.
Derp, I already suggested this here: https://github.com/ampproject/amphtml/issues/10230#issuecomment-318405678
/cc @ericlindley-g
Overall, when users tap, they expect jumps of UI to accommodate whatever they tapped for. So I think opt-out is a bit less of a concern to me.
I think not all taps imply user intent. Sometimes I tap when I really mean to start scrolling, or accidentally tap with my palm.
De-duping in favor of #10230.