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

Gallery block does not respect opting out of base layout styles #47948

Open
cbirdsong opened this issue Feb 9, 2023 · 3 comments
Open

Gallery block does not respect opting out of base layout styles #47948

cbirdsong opened this issue Feb 9, 2023 · 3 comments
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Type] Bug An existing feature does not function as intended

Comments

@cbirdsong
Copy link

cbirdsong commented Feb 9, 2023

Description

The gallery block does not respect the ability to opt out of base layout styles via add_theme_support( 'disable-layout-styles' );.

Step-by-step reproduction instructions

  1. Add add_theme_support( 'disable-layout-styles' ); to a non-FSE theme.
  2. Add a gallery block to a page.
  3. Inspect the gallery block. You will find a class like .wp-block-gallery-10 and an accompanying <style> block like this:
.wp-block-gallery.wp-block-gallery-10 {
    --wp--style--unstable-gallery-gap: var(--wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) );
    gap: var(--wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) );
}

Environment info

  • WordPress 6.1, core version of Gutenberg

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@karmatosed karmatosed added the Needs Testing Needs further testing to be confirmed. label Feb 11, 2023
@skorasaurus skorasaurus added the [Block] Gallery Affects the Gallery Block - used to display groups of images label Feb 13, 2023
@ndiego
Copy link
Member

ndiego commented Feb 21, 2023

Thanks for reporting @cbirdsong. I am able to confirm in Twenty Twenty-One using WordPress 6.2 Beta 2 and the latest version of Gutenberg.

image

@ndiego ndiego added [Type] Bug An existing feature does not function as intended and removed Needs Testing Needs further testing to be confirmed. labels Feb 21, 2023
@cbirdsong
Copy link
Author

I can confirm this is still an issue in WordPress 6.3.

@webexpr-dhenriet
Copy link

@cbirdsong

I can also confirm that the style is not applied to a hybrid theme (not FSE) on wp 6.4.3.
In my theme.json file I have set the blockGap spacing to 0

"styles": {
  "spacing": {
    "blockGap": "0"
  }
}

The css variable --wp--style--block-gap is equal to 0, --gallery-block--gutter-size is undefined.
The gallery images are displayed one below the other instead of respecting the columns

.wp-block-gallery.wp-block-gallery-1 {
    --wp--style--unstable-gallery-gap: var(--wp--style--gallery-gap-default, var(--gallery-block--gutter-size, var(--wp--style--block-gap, 0.5em)));
    gap: var(--wp--style--gallery-gap-default, var(--gallery-block--gutter-size, var(--wp--style--block-gap, 0.5em)));
}

Screenshot_1

I can correct this by applying :

"styles": {
  "blocks": {
    "core/gallery": {
        "css": "--wp--style--block-gap: 1rem"
     }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

5 participants