-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Get orientation for Spacer block from parent layout #49322
Conversation
Size Change: +36 B (0%) Total Size: 1.34 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works great, lovely to see one less needed attribute for navigation! 🙇🏻 Thank you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change, it feels much better having this be tied to the parent layout rather than explicitly passing down the orientation
attribute from the navigation block 👍
Does this mean we can also remove this line from the spacer block's block.json
file?
"usesContext": [ "orientation" ], |
Apologies, I was typing too quickly! I see you've retained the existing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is generally working quite nicely! I ran into a couple of minor issues while testing with Row and Stack variations.
With Row block, it lists the height as null
when dragging it. Should we use a 48px
minHeight for consistency with the rule to help out the Stack variation?
When switching the parent Row between Row and Stack, because a height value isn't available yet, I found it hard to click on the Spacer block within the editor canvas. This mightn't be something to try fixing in this PR, though, if it seems more complex to deal with.
I'm not sure why this happens, because there's a default 24px height defined for horizontal orientation already. Fwiw, I can reproduce it on trunk with the Navigation block, as well as the other bug you mention above:
It might be worth looking into these separately as it doesn't seem they were caused by these changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth looking into these separately as it doesn't seem they were caused by these changes.
Sounds good, this PR is already a big improvement over what's on trunk for both the Row and Stack variations 👍
LGTM! ✨
Yeah I thought that there might be 3rd party blocks providing that context, so better avoid breaking it 😅 |
f6007cc
to
8a9fd87
Compare
Dev noteSpacer block gets orientation from parent block layoutSpacer blocks inside a |
What?
Fixes #36197.
Prelude to addressing #38022.
Changes the Spacer orientation logic so that it looks for a value in the parent layout. Spacers inside Rows should now be oriented correctly.
Also removes the context provider from Navigation block because Spacer can now read from its layout instead.
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast