Open metropoliscreative opened 2 days ago
@metropoliscreative Could you share a recorded video of the issue? Also, could you clarify the intended behavior here and the reasoning behind it?
Thanks
First video shows a sample block with layout support and the default layout type set to flex. The block toolbar contains both justification and alignment controls.
block.json supports:
"supports": {
"layout": {
"allowSwitching": false,
"default": {
"type": "flex"
}
}
}
https://github.com/user-attachments/assets/ce98f8cf-7727-4974-af0e-565c79f80c30
The next video shows the same block with allowSwitching enabled. When the Flex layout is selected for the block there is a justification control but no alignment control.
block.json supports:
"supports": {
"layout": {
"allowSwitching": true
}
}
https://github.com/user-attachments/assets/fb8a872f-9c43-47a1-b10d-24963a03ad7b
could you clarify the intended behavior here and the reasoning behind it?
I would expect the block to receive alignment control along with justification control when the layout type is set to flex, even if switching the layout type is enabled for the block.
Hi @metropoliscreative,
Thank you for bringing this up. I’ve looked into it and was able to reproduce the issue as follows:
"supports": {
"layout": {
"allowSwitching": true
}
},
"supports": {
"layout": {
"allowSwitching": false,
"default": {
"type": "flex"
}
}
}
To improve accessibility and provide a better user experience, I believe adding settings for this functionality within the block toolbar would be a great enhancement.
Description
When a block has layout support and the
allowSwitching
subproperty is set totrue
, the vertical alignment setting should be displayed in the block toolbar when the layout is set to flex. The alignment setting is not shown unless allowSwitching is set to false (the default) and flex is the default layout type.Step-by-step reproduction instructions
Create a block with layout support and
allowSwitching
set totrue
Screenshots, screen recording, code snippet
This is the code that prevents the alignment button from being added to the block toolbar when
allowSwitching
is set totrue
: https://github.com/WordPress/gutenberg/blob/e7f0dc53ab3d8bbd53bd19129e00ed34aad67326/packages/block-editor/src/layouts/flex.js#L97-L99Environment info
WordPress 6.7, Gutenberg plugin not active
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.