Skip to content

Social Icons: Fix styling when oriented vertically#37986

Closed
ndiego wants to merge 1 commit intoWordPress:trunkfrom
ndiego:fix/social-icons-styling-when-oriented-vertically
Closed

Social Icons: Fix styling when oriented vertically#37986
ndiego wants to merge 1 commit intoWordPress:trunkfrom
ndiego:fix/social-icons-styling-when-oriented-vertically

Conversation

@ndiego
Copy link
Copy Markdown
Member

@ndiego ndiego commented Jan 14, 2022

Description

When the Social Icons block is oriented vertically, the individual links span the entire width of the content area and do not maintain their correct width. This issue appears to be a regression in the latest version of Gutenberg since the issue is not present in WordPress 5.9 RC2.

What's strange is that the CSS provided by the Social Icons block has not changed in recent months, so this issue must be caused by something else. I have not been able to isolate it. The root of the issue is that in the editor, align-items: flex-start; is added to the block. On the frontend, this CSS does not exist. This PR simply adds it back.

How has this been tested?

  1. Use Twenty Twenty-Two with Gutenberg 12.4 RC1 and WordPress 5.9 RC2
  2. Add the Social Icons block with a couple Social Icons
  3. Orient the block vertically. See that it displays correctly in the Editor
  4. Switch to the Frontend and see that with this PR the icons display correctly as well, without this PR they render like the screenshots below

Screenshots

Without the fix in this PR with Gutenberg 12.4 RC1 active in the TT2 theme:
image

With the fix, the icons display correctly:
image

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).
  • I've updated related schemas if appropriate.

@ndiego ndiego requested a review from mkaz as a code owner January 14, 2022 16:49
@ndiego ndiego added the [Block] Social Affects the Social Block - used to display Social Media accounts label Jan 14, 2022
@ndiego ndiego self-assigned this Jan 14, 2022
@ndiego ndiego added the [Type] Bug An existing feature does not function as intended label Jan 14, 2022
Copy link
Copy Markdown
Contributor

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

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

👋 @ndiego, thanks for the PR!

It's worth noting that this happens only when you haven't selected any content-justfication option before, and you just change the orientation to vertical.

The problem lies in the default value of this prop in the layout abstraction. In editor we handle it here, but in the server we need a similar treatment of align-items in this line.

After that change, we would need to test other blocks with flex layout for any regression, though I don't believe there will be any..

@ndiego
Copy link
Copy Markdown
Member Author

ndiego commented Jan 18, 2022

Ah I see, I will make that update later this morning. Thanks for the review.

@ntsekouras ntsekouras closed this Jan 19, 2022
@ndiego ndiego deleted the fix/social-icons-styling-when-oriented-vertically branch January 19, 2022 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Social Affects the Social Block - used to display Social Media accounts [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants