-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Lightbox(es) should support exiting with escape and x button #1029
Conversation
b43bd6f
to
c3bf727
Compare
cc @cramforce |
<div class="lightbox1-content"> | ||
<amp-img id="img0" src="https://lh4.googleusercontent.com/-okOlNNHeoOc/VbYyrlFYFII/AAAAAAABYdA/La-3j3c-QQI/w452-h900-p/PANO_20150726_171347%257E2.jpg" width=226 height=450 layout="responsive"></amp-img> | ||
<div class="lightbox1-content" close> | ||
<amp-img id="img0" src="https://lh4.googleusercontent.com/-okOlNNHeoOc/VbYyrlFYFII/AAAAAAABYdA/La-3j3c-QQI/w452-h900-p/PANO_20150726_171347%257E2.jpg" width=226 height=450 layout="responsive" on="tap:lightbox1.close"></amp-img> |
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.
I somewhat overheard but missed the argument why the "close" attribute is needed. Could you explain?
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.
The spec (md file) says close attr should work , hence the support for the close attr.
UPDATE: Removed now
023f1b3
to
6600685
Compare
@@ -706,6 +706,11 @@ class AmpImageLightbox extends AMP.BaseElement { | |||
this.reset_(); | |||
this.init_(source); | |||
|
|||
/** @private {function(this:AmpLightbox, Event)}*/ | |||
this.boundCloseOnEscape_ = event => this.closeOnEscape_(event); |
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.
this.closeOnEscape_.bind(this)
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.
Done
6600685
to
ba96f66
Compare
@@ -22,7 +22,8 @@ The `amp-lightbox` component allows for a “lightbox” or similar experience - | |||
|
|||
The `amp-lightbox` component defines the child elements that will be displayed in a full-viewport overlay. It is triggered to take up the viewport when the user taps or clicks on an element with `on` attribute that targets `amp-lightbox` element’s `id`. | |||
|
|||
One or more elements within the lightbox can be optionally given a `close` attribute, which when tapped or clicked will close the lightbox. If no element is given a `close` attribute, a tap or click anywhere on the screen will close it. | |||
Pressing the escape key on the keyboard will close the lightbox. |
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.
Add sub headline for closing the lightbox.
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.
Done
58f3b2b
to
65052e8
Compare
@@ -706,6 +706,11 @@ class AmpImageLightbox extends AMP.BaseElement { | |||
this.reset_(); | |||
this.init_(source); | |||
|
|||
/** @private {function(this:AmpLightbox, Event)}*/ |
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.
Either AmpImageLightbox
or you can simply do {!Function}
- the exact signature in this case doesn't matter - you never call it in the code.
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.
Done
LGTM with one comment. |
- When ESC key is hit - When a child element with `close` attribute is clicked - When a child element with on attribute is set to "tap:lightbox-id.close" Remove functionality that closes lightbox when tapped anywhere. Image Lightbox(es) should support exiting - When ESC key is hit
65052e8
to
0524e59
Compare
Lightbox(es) should support exiting with escape and x button
Lightbox(es) should support exiting
close
attribute is clickedRemove functionality that closes lightbox when tapped anywhere.
Image Lightbox(es) should support exiting
This is being tracked in Lightbox(es) should support exiting with escape and x button #342