Skip to content
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

Merged
merged 1 commit into from
Dec 2, 2015

Conversation

camelburrito
Copy link
Contributor

Lightbox(es) should support exiting

  • 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

@camelburrito
Copy link
Contributor Author

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>
Copy link
Member

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?

Copy link
Contributor Author

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

@camelburrito camelburrito force-pushed the lightbox branch 5 times, most recently from 023f1b3 to 6600685 Compare December 1, 2015 02:20
@camelburrito camelburrito changed the title Lightbox(es) should support exiting Lightbox(es) should support exiting with escape and x button Dec 1, 2015
@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.closeOnEscape_.bind(this)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -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.
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@camelburrito camelburrito force-pushed the lightbox branch 2 times, most recently from 58f3b2b to 65052e8 Compare December 2, 2015 02:24
@@ -706,6 +706,11 @@ class AmpImageLightbox extends AMP.BaseElement {
this.reset_();
this.init_(source);

/** @private {function(this:AmpLightbox, Event)}*/
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@dvoytenko
Copy link
Contributor

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
camelburrito pushed a commit that referenced this pull request Dec 2, 2015
Lightbox(es) should support exiting with escape and x button
@camelburrito camelburrito merged commit 95a6d8e into ampproject:master Dec 2, 2015
@camelburrito camelburrito deleted the lightbox branch December 2, 2015 21:40
@henel677 henel677 mentioned this pull request Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants