-
Notifications
You must be signed in to change notification settings - Fork 384
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
Fix lightbox on file-linked galleries #3097
Fix lightbox on file-linked galleries #3097
Conversation
Right now, the test suite has 2 failures: It looks like these cases are not yet handled by the gallery embed handler, as it spits out non-AMP HTML (probably the unmodified original shortcode handler output). Also, if you don't specifiy the AMP carousel switch value at all, it seems to default to using a carousel nevertheless. Is that the intended behavior? |
There's some backwards-compatibility considerations here. When in Reader mode, the intention is to always show the carousel by default since that is how galleries worked in Reader mode. In Standard/Transitional, the behavior changes to default to the regular gallery output and to instead opt-in to the carousel. Is this what you're seeing? |
I haven't tried this on the frontend, this is purely from running the sanitizer within tests and setting its flags. The gallery embed code does not contain any reference of the mode, so I doubt that is the case here, unless one of the two scenarios (reader vs standard/transitional) hasn't been implemented yet. For the non-AMP output, you can see the result here: https://travis-ci.org/ampproject/amp-wp/jobs/577377621#L1208-L1224 So, here's what we need to decide upon:
|
In Reader mode, a gallery uses an I just tried adding a Gallery block and I'm not seeing the carousel toggle: But in the Reader-mode template, it is shown as a carousel: If I switch to Transitional mode, then I do see a toggle but it is disabled by default: And on the frontend: And when enabling the toggle, then I see a carousel on the frontend: Perhaps the confusion is that there is actually a gallery sanitizer as well: amp-wp/includes/amp-helper-functions.php Lines 842 to 844 in 9337046
Yes, the gallery handling is somewhat convoluted! |
No, it's not a bug because the |
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.
Approved
Hi @schlessera and @westonruter,
Sorry for the delay. This looks good, and it's really nice how it adds a test class AMP_Gallery_Embed_Test
.
Before
Even when a gallery shortcode had 'Add lightbox effect' selected:
...it still didn't have the lightbox effect on the front-end:
After
The lightbox effect works on the front-end, <amp-img>
tags in the carousel have on="tap:amp-lightbox-gallery.activate"
/** | ||
* @dataProvider get_conversion_data | ||
*/ | ||
public function test__conversion( $source, $expected ) { |
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.
Wow, great test file with this @dataProvider
Thanks for all the context. Based on the above, I assume that the current tests should then compare to what should be expected. They can certainly be extended, but I'd suggest doing so in subsequent tickets to get this one moving. |
Add the
lightbox
attribute to gallery shortcode images when they are being linked to by file and the AMP lightobx setting is enabled.There was no test suite yet for the gallery embed handler, so I added a test suite to make sure this works as expected.
Fixes #2850