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

Flex Layout: Incorrect default alignment value used in Vertical Alignment Control Component #68864

Open
3 of 6 tasks
yogeshbhutkar opened this issue Jan 24, 2025 · 0 comments · May be fixed by #68866
Open
3 of 6 tasks
Assignees
Labels
[Feature] Layout Layout block support, its UI controls, and style output. [Package] Block editor /packages/block-editor [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@yogeshbhutkar
Copy link
Contributor

Description

Originally discovered by @luisherranz while testing here #68112 (review) and splitting it from the enhancement as this is an existing bug.

const defaultVerticalAlignment =
orientation === 'horizontal'
? verticalAlignmentMap.center
: verticalAlignmentMap.top;

Here, the default value of vertical alignment when the orientation is set to vertical is essentially verticalAlignmentMap.top which resolves to flex-start, which is not acceptable for the Toolbar. This causes the default value to remain unselected within the Vertical Alignment Toolbar.

Acceptable values:

? [ 'top', 'center', 'bottom', 'stretch' ]

const verticalAlignment =
verticalAlignmentMap[ layout.verticalAlignment ];

It's expected that layout.verticalAlignment holds the key instead of the value, failing to do so causes the bug mentioned above (No default alignment value being rendered on the toolbar when the orientation is set to columns).

I searched the issue repository but couldn’t find a similar report. Please feel free to close this if it’s a duplicate.

Step-by-step reproduction instructions

  1. Create a Row block.
  2. Verify that the default value of Alignment in the Toolbar is set as Align middle.
  3. Convert the Row to a Column block.
  4. Notice, that the Alignment value within the Toolbar is missing, whereas, it should have been selected as Top.

Screenshots, screen recording, code snippet

Image

Environment info

  • WordPress Version: 6.8-alpha-59361
  • Gutenberg Version: Trunk (654bace)
  • OS: macOS Sequoia

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

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@yogeshbhutkar yogeshbhutkar added the [Type] Bug An existing feature does not function as intended label Jan 24, 2025
@yogeshbhutkar yogeshbhutkar changed the title FlexLayoutVerticalAlignmentControl uses incorrect default alignment value Flex Layout: Incorrect default alignment value used in Vertical Alignment Control Component Jan 24, 2025
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jan 24, 2025
@t-hamano t-hamano added [Package] Block editor /packages/block-editor [Feature] Layout Layout block support, its UI controls, and style output. labels Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Layout Layout block support, its UI controls, and style output. [Package] Block editor /packages/block-editor [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
2 participants