🐛amp-consent: Fixed the flash of the leftover CMP Iframe Container (Flash of teal) #20086
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
relates to #19969
This essentially reverts #19830 . I kept this PR in a note in case I noticed something weird down the line and I am glad I did 😂I think this should be undone for the following reasons:
This was meant to fix amp-iframe can create multiple iframe when scheduled layout more than once #19599 , but we eventually found the actual fix was 🐛Amp-iframe: Only create one iframe #19603
updateFixedLayer
is only used inamp-live-list
. And I think it's more for dynamically incoming multiple fixed elements.updateFixedLayer
throws a console error about the element already having atop
applied before being removed.removeFromFixedLayer
appears to be the better option still, as we are hiding / removing the element, thus it should also be removed from the fixed layer, and not updated since it no longer exists.The root cause however, is due to how the fixed layer will handle the
top
styling for elements. When we add it, the top is set to 0px for us. But when we use update to remove (which also removes all the classes), this top is re-applied which causes the flash, because the100vh
element gets pulled to the top, before being removed.removedFromFixedLayer
, removes thistop
styling entirely (which is what we want).@zhouyx Let me know what you think! 😄
Gifs
Bug
The low gif framerate may not show the bug, but still shows the console error.
Fix