'hidden-mutation-observer' breaks amp-lightbox
bug
- when close
amp-lightboxwith close event can not really close it if theamp-lightboxhaveposition: fixed
reproduce
-
open detail page
-
click Free Ship

-
click Ship To

-
and close it

-
Page gets stuck. It has no effect no matter where you click.
analysis

- because the amp-lightbox have
position: fixed, so when you click and trigger close event the amp-lightbox not really close, it is just opacity set to 0
What browsers are affected?
- all browsers, ios and android
version
- Powered by AMP ⚡ HTML – Version 1811012008580
Looks like transitionend or animationend events are not triggered by setting the closedStyle, which means this collapse callback is never called. Not sure why yet.
Doesn't repro on the ABE example which also uses the amp-lightbox.close action.
please try with the sample here : https://github.com/aemsite/ampdemo/blob/master/cant-close-lightbox.html
Basically when the lightbox is styled with position:fixed, then when users trigger lightbox.close actions, the [hidden] will not be appended to the lightbox anymore.
Yea, probably related to fixed-layer. Looks like the problematic lightbox is being tracked by FixedLayer per its i-amphtml-fixedid:
<amp-lightbox id="country-lb"
class="float-wrap i-amphtml-element i-amphtml-layout-nodisplay i-amphtml-overlay i-amphtml-scrollable i-amphtml-layout"
layout="nodisplay"
scrollable=""
i-amphtml-fixedid="F10"
style="opacity: 0; top: calc(0px);">
@leonalicious Adding position: fixed and top and bottom CSS is redundant since amp-lightbox already has it:
https://github.com/ampproject/amphtml/blob/78e80f1ac5de8ed96d529e54db2da4a064ebb94b/extensions/amp-lightbox/0.1/amp-lightbox.css#L16-L24
transitionend and animationend events are not triggered because FixedLayer sets transition: none: https://github.com/ampproject/amphtml/blob/78e80f1ac5de8ed96d529e54db2da4a064ebb94b/src/service/fixed-layer.js#L378-L382
This only became a problem after #18797. The mutation observer causes the unsetting of transition after the amp-lightbox has its hidden attribute removed during opening.
Disabling hidden-mutation-observer experiment fixes this, which is an easy and low-risk cherry-pick. @cvializ
One idea to roll-forward is to avoid tracking AMP elements that are known to be fixed-position e.g. amp-lightbox, amp-image-lightbox, etc. A simple early-return in FixedLayer.setupElement_ appears to work.
The issue is not with hidden-mutation-observer, but the experiment surfaced it. This can still happen if a fixed-layer update happens in between the close action and when the transition actually finishes.
True but when do fixed-layer updates trigger without the mutation observer? AFAICT only on init and a few special cases (viewer, amp-live-list).
This is fixed in version 1811051833450.
#19149 tracks the follow-up work that will allow hidden-mutation-observer to roll forward.
hey, thank you for the prompt fixed , but just FYI, we have tested, it is working fine on Android and iOS safari, but not on iOS Chrome, we are still looking at it...
Hmm, works fine for me on iOS Chrome 72 on iOS 12.
hey, thank you for the prompt fixed , but just FYI, we have tested, it is working fine on Android and iOS safari, but not on iOS Chrome, we are still looking at it...
I think that's a new issue. This time, when you click the close button on the top left corner of the shipping-to country list, the page is not stuck, but you will be brought back to the product list page.
here you go with the UA of Chrome on iOS:
Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/70.0.3538.75 Mobile/15E148 Safari/605.1
hope it helps.