-
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
DataViews Fix: Preview not displayed in Templates table layout #58254
Conversation
Thanks for the PR! I have an alternative in place for some days with a different approach. My thinking was, if we cannot avoid |
Size Change: +6 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
@ntsekouras Thank you for letting me know about that PR! Indeed, I think the approach explored in #58062 makes more sense, so I'm happy to close this PR. |
Probably a regression in #57804
What?
This PR fixes an issue where the preview is not displayed when the Template's data view is a table layout.
Before
After
Why?
In #57804,
display:flex
was applied to elements with the.dataviews-view-table__cell-content-wrapper
class.The child of this element is the element with the
page-templates-preview-field
class, but because it is a flexbox child, if it contains no content and does not have an explicit width, the width will always be zero.As a result, I found that the
BlockPreview
component failed to obtain the width using theuseResizeObserver()
hook, and the preview was not rendered.gutenberg/packages/block-editor/src/components/block-preview/auto.js
Lines 130 to 135 in 61f7d05
How?
I applied 100% width to an element with
page-templates-preview-field
class. We can also solve this by applyingflex:1
instead, but I thinkwidth
is more intuitive.Testing Instructions