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
Don't show nav or gallery controls if there is only one lightboxed image #15475
Conversation
4449dff
to
ddf80c2
Compare
Rebasing for bundle size flake. |
ddf80c2
to
748ea8d
Compare
This pull request introduces 1 alert when merging 748ea8d into d175fb8 - view on lgtm.com new alerts:
Comment posted by lgtm.com |
748ea8d
to
fe69ae0
Compare
*/ | ||
toggleNavControls_(noOfChildren) { | ||
if (noOfChildren > 1) { | ||
this.controlsContainer_.classList.remove('i-amphtml-lbg-single'); |
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.
nit: You can use classList.toggle
e.g.
this.controlsContainer_.classList.toggle('i-amphtml-lbg-single', noOfChildren <= 1);
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.
super optional nit: childCount
is easier to read since it doesn't use an abbreviation
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.
Do you plan to use the CSS class i-amphtml-lbg-single
for other purposes? If not, you can toggle the internal class i-amphtml-hidden
that AMP already uses to hide elements.
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.
Oh excellent.
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.
Oh... hmm. I'll need to toggle it for three elements I guess.
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.
That's true, that could introduce complexity. I'm fine with the CSS how it is.
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.
FYI I just checked though. We don't actually have an i-amphtml-hidden
css class. We have an amp-hidden
class. It doesn't have default behavior, but each component defines behavior for it separately...
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.
Ah I grepped too quickly!
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.
LGTM
Closes #15198, since
<amp-lightbox-gallery>
is now launched, and this covers the single-image usecase.