-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix Spacer orientation when inside a block with default flex layout. #58921
Conversation
Size Change: +15 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
check there's no type before using default type Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com>
Thanks for pushing my suggestion — unfortunately it broke the linting rule, so I've just pushed a tiny commit to fix that up in bed3611 — hope you don't mind! |
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.
All testing nicely for me, thanks for fixing this up! ✨
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.
While researching this issue, I found that even though this issue was occurring, the block mover button was still pointing in the correct direction.
orientation: getBlockListSettings( _rootClientId )?.orientation, |
Maybe I'm missing something, but do you think it makes sense to apply this logic?
const { orientation } = useSelect(
( select ) => {
const {
getBlockListSettings,
getBlockRootClientId,
} = select( blockEditorStore );
const _rootClientId = getBlockRootClientId( clientId );
return {
orientation: getBlockListSettings( _rootClientId )?.orientation,
};
},
[ clientId ]
);
Flaky tests detected in 240209f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7867796936
|
Immediately after I posted this comment, I found out that it had been approved 😄 I'm fine with this approach if it works as expected with the current implementation 👍 |
Good point @t-hamano! In this case, I think the layout logic likely still needs to be updated because whether or not it's within a flex layout will dictate if the block updates the |
Likewise, I only saw your comment after I hit the button! Very good points and observations as always 🙂 |
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.
LGTM! Sorry for confusing 🙇
The parent layout passed into block edit will give us the orientation, the problem was I wasn't checking the layout type in all the places it might appear. I think we should avoid using selectors if we already have what we need via the props passed to block edit. Thanks for the suggestion in any case! And thanks everyone for reviewing! |
Question, is this a fix that should get back ported into WordPress 6.5? I think given that it is a bug fix it would qualify. |
Definitely. I see Riad has now added the label. |
…58921) Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org>
I just cherry-picked this PR to the backports/beta1 branch to get it included in the next release: 781dc3b |
…58921) Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org>
…58921) Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org>
What?
Fixes #58894.
We should be checking the default layout type as well as the non-default when trying to determine Spacer block orientation based on parent layout.
This was particularly evident in the Navigation block because its default layout type is flex.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast