-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Only pass parentLayout to block edit if not empty #46390
Conversation
Size Change: +14 B (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
@@ -152,7 +152,9 @@ function BlockListBlock( { | |||
isSelectionEnabled={ isSelectionEnabled } | |||
toggleSelection={ toggleSelection } | |||
__unstableLayoutClassNames={ layoutClassNames } | |||
__unstableParentLayout={ parentLayout } | |||
__unstableParentLayout={ | |||
Object.keys( parentLayout ).length ? parentLayout : undefined |
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.
Is it possible for parentLayout
to be null
or undefined
? If so Object.keys()
will throw an exception here.
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.
I don't think so, but perhaps it's best to explicitly make it default to an empty object to be on the safe side.
Some checks are failing, I'll attempt a rebase from |
f2391e1
to
ab9ea4e
Compare
Thanks for the fix @tellthemachines! |
* Only pass parentLayout to block edit if not empty * Make sure object.keys check doesn't error
Why?
Follow-up to #45364.
How?
Adds logic so that
allowSizingOnChildren
doesn't get passed to the Edit function of every single block, even when the parent block isn't setting it explicitly. If the parent block has no layout configured,__unstableParentLayout
should be undefined.Testing Instructions
Testing Instructions for Keyboard
With a child of a Row block selected, press Tab to go into the sidebar, Tab again to go the "Block" area, and then continue tabbing until reaching the "Dimensions options" button. Press Enter to open, Tab until reaching "Width" and press Enter to select. Press Esc to close the dropdown and then press Tab again to focus the Width control. Once focused, toggle between the options with Arrow keys. If selecting "Fixed", Tab again to reach the input and fill it in with a fixed width value.
Screenshots or screencast