-
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 input not showing when switching to "Fixed" width #56660
Conversation
Size Change: +741 B (0%) Total Size: 1.72 MB
ℹ️ View Unchanged
|
Flaky tests detected in 2d929a5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7040046292
|
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.
Thanks for picking this up!
Unfortunately this only appears to resolve the issue when toggling from Fit to Fixed directly. If I go from Fill to Fixed, it still doesn't reveal the unit control for me (presumably because there hasn't been a change to force an update when switching between Fill and Fixed?):
2023-11-30.13.49.54.mp4
Thanks for testing @andrewserong ! I've pushed an update to remove the checks entirely and always render |
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.
That's working nicely in the UI for me, now! It means we remove some of the optimisations from #55762, but I think fixing the UI is probably a priority for now. The only potential blocker I encountered is that it seems this removes the disableLayoutStyles
check that prevents the styling rules and classname from being output. With this PR applied I can see the flex-grow: 1
rule is output for a block set to fill
, whereas on trunk
running a theme with add_theme_support( 'disable-layout-styles' );
they get skipped. Here's the output for this PR:
return ! select( blockEditorStore ).getSettings() | ||
.disableLayoutStyles; |
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.
Will this removal mean the styles and classnames get generated and output if disableLayoutStyles
is true
?
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.
Oh, of course, well spotted! Let me see if this still works if we keep it.
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.
Ok I think I've fixed it now 😅
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 one, thanks for the back and forth!
✅ Switching between any of the toggles to Fixed or back now reliably shows the unit control
✅ If a theme has add_theme_support( 'disable-layout-styles' );
active, then the CSS rules and classname are skipped as expected, while the toggling between controls still works
✅ It looks safe to me that blocks are still run through BlockWithChildLayoutStyles
as useStyleOverride
will bail and not call setStyleOverride
if css
is an empty string, and the classname will not be applied 👍
LGTM! ✨
As usual, @andrewserong is too fast! The screencast doesn't show it, but the input shows also when toggling between Fixed, Fit and Fill, and then back to Fixed. 2023-11-30.15.40.35.mp4🚢 |
Thanks for the reviews folks! I'm going to go ahead and merge this now, and I'll open a new issue for resetting the toggle. I've just checked and that issue is in 6.4 so it predates this one. |
Thank you, @tellthemachines! |
I've created #56667 to address the toggle issue. |
* Fix input not showing when switching to "Fixed" width * Always render BlockWithChildLayoutStyles * Render BlockWithChildLayoutStyles if layout is enabled
What?
Fixes the regression described here. The refactor of the layout rendering logic indirectly caused a bug in the child layout controls component, as detailed here.
This fix makes sure that the check for rendering child layout styles insidewithChildLayoutStyles
is consistent with the logic inBlockWithChildLayoutStyles
, so that component will only render when there is CSS to output.Update: this fix removes the check inside
withChildLayoutStyles
altogether so thatBlockWithChildLayoutStyles
is always rendered, and it decides whether there are styles to render or not.Testing Instructions
TODO: the "Fixed" toggle should reset to "Fit" on page reload if there's no actual value set.
Edit: the toggle reset issue is described here and might need a separate fix.
Testing Instructions for Keyboard
Screenshots or screencast