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

Row (Group variation) styling doesn't work for themes without layout support #35439

Closed
ZebulanStanphill opened this issue Oct 7, 2021 · 3 comments
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Block] Group Affects the Group Block CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Bug An existing feature does not function as intended

Comments

@ZebulanStanphill
Copy link
Member

Description

The generated styles for the Row variation of the Group block do not work for themes that haven't enabled layout support in their theme.json (or just lack a theme.json entirely). This old Group markup, which has a nested div for the content with the class: wp-block-group__inner-container, is not accounted for in the generated front-end styles.

The result is that, when using these themes, although you can easily insert a Row in the block editor (and it looks just fine there), the Row erroneously appears the same as a vertical Group on the front-end.

Step-by-step reproduction instructions

  1. Use a theme that doesn't declare layout support. (Astra is a popular one.)
  2. Create/edit a page in the block editor, insert a Row (the quickest way is to use the slash inserter in an empty Paragraph).
  3. Insert some blocks into the row. Observe that it looks correct in the editor.
  4. Save and view the page on the front-end. Observe that it looks wrong.

Screenshots, screen recording, code snippet

No response

Environment info

Wordpress 5.8.1

Gutenberg 11.6.0 (also happens in latest trunk as of when I'm making this issue)

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

@ZebulanStanphill ZebulanStanphill added [Type] Bug An existing feature does not function as intended Backwards Compatibility Issues or PRs that impact backwards compatability [Block] Group Affects the Group Block [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. CSS Styling Related to editor and front end styles, CSS-specific issues. labels Oct 7, 2021
@youknowriad
Copy link
Contributor

Hi @ZebulanStanphill I tried debugging this but failed for now. In 2021 theme which doesn't support "layout" either, it works properly.

The issue comes from the fact that the wp-block-group__inner-container div is added to the frontend when using Astra theme. but we do have logic in place to prevent this div from being added in gutenberg_restore_group_inner_container. I wonder if Astra is doing something special with that hook.

@Sandstromer
Copy link

Yes it seems to an issue with the Astra theme.

See astra/inc/compatibility/class-astra-gutenberg.php L24 the comment:
Add Group block inner container when theme.json is added to avoid the group block width from changing to full width.

and L35 restore_group_inner_container() function.

@ZebulanStanphill
Copy link
Member Author

Thanks, I've opened an issue at Astra's GitHub: https://github.com/brainstormforce/astra/issues/3431

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Block] Group Affects the Group Block CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants