Skip to content

Commit

Permalink
Revert "Hide captions in galleries when opening lightbox"
Browse files Browse the repository at this point in the history
This reverts commit 40c28b9.
  • Loading branch information
artemiomorales committed Jul 18, 2024
1 parent 40c28b9 commit 59a63c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
4 changes: 2 additions & 2 deletions packages/block-library/src/image/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ function block_core_image_render_lightbox( $block_content, $block ) {
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP
)
);
$p->set_attribute( 'data-wp-class--hide-content', 'state.isContentHidden' );
$p->set_attribute( 'data-wp-class--show-content', 'state.isContentVisible' );

// Image.
$p->next_tag( 'img' );
Expand All @@ -232,6 +230,8 @@ function block_core_image_render_lightbox( $block_content, $block ) {
// contain a caption, and we don't want to trigger the lightbox when the
// caption is clicked.
$p->set_attribute( 'data-wp-on-async--click', 'actions.showLightbox' );
$p->set_attribute( 'data-wp-class--hide', 'state.isContentHidden' );
$p->set_attribute( 'data-wp-class--show', 'state.isContentVisible' );

$body_content = $p->get_updated_html();

Expand Down
20 changes: 3 additions & 17 deletions packages/block-library/src/image/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,15 @@
max-width: 100%;
vertical-align: bottom;
box-sizing: border-box;
}

@media (prefers-reduced-motion: no-preference) {
&.hide-content {
img {
@media (prefers-reduced-motion: no-preference) {
&.hide {
visibility: hidden;
}
figcaption {
.wp-block-gallery & {
visibility: hidden;
}
}
}

&.show-content {
img {
&.show {
animation: show-content-image 0.4s;
}
figcaption {
.wp-block-gallery & {
animation: show-content-image 0.4s;
}
}
}
}

Expand Down

0 comments on commit 59a63c3

Please sign in to comment.