Fix bug where lightboxed carousel images show up twice - #13563
Merged
cathyxz merged 5 commits intoFeb 21, 2018
Conversation
cathyxz
force-pushed
the
bugfix/extra-images-on-carousel
branch
from
February 21, 2018 00:41
19c2053 to
cd69570
Compare
aghassemi
reviewed
Feb 21, 2018
| ampClasses.push(cssClass); | ||
| } | ||
| } | ||
| clonedNode.classList.remove.apply(clonedNode.classList, ampClasses); |
Contributor
There was a problem hiding this comment.
I think we can remove all classes from the clone. I don't see a lot of situations where the style for the opener should apply to the lightboxed version. If anything it can cause weird bugs.
Contributor
There was a problem hiding this comment.
what does amp-image-lightbox do?
Contributor
Author
There was a problem hiding this comment.
It only propagates the aria-attributes, not the source.
Object.keys(this.ariaAttributes_).forEach(key => {
this.ariaAttributes_[key] = sourceElement.getAttribute(key);
if (this.ariaAttributes_[key]) {
this.image_.setAttribute(key, this.ariaAttributes_[key]);
}
});
aghassemi
approved these changes
Feb 21, 2018
| const clonedNode = element.cloneNode(deepClone); | ||
| clonedNode.removeAttribute('on'); | ||
| clonedNode.removeAttribute('id'); | ||
| clonedNode.setAttribute('class', ''); |
cathyxz
force-pushed
the
bugfix/extra-images-on-carousel
branch
from
February 21, 2018 18:08
9d323e4 to
6cdab96
Compare
Contributor
Author
|
Had to rebase for visual diff tests. |
cvializ
approved these changes
Feb 21, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Happens when you lightbox the image inside the carousel, like so:
The bug itself is a bit awkward. It's because I can't toggle
display: noneon an<amp-img>with the.amp-scrollable-carousel-slideclass, since it sets thedisplaycss property with!important. I'm not sure whether we should be using!importantthere, and I'm also not sure if theamp-scrollable-carousel-slideclass should be prefixed withi-amphtmlinstead ofamp-.It seems reasonable to strip amp-related css classes, since basically what we're doing is taking the raw image with its raw aspect ratio, and blowing it to fill the screen. I'm wondering if we could just strip ALL CSS classes, or are there situations where it would be valid to keep the user-defined css classes? It's possible, like maybe they apply an opacity, or other visual effects...