-
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 nested buttons and placeholder text in list layout #58304
DataViews: Fix nested buttons and placeholder text in list layout #58304
Conversation
Size Change: +22 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
47d27c3
to
5d20ce1
Compare
</button> | ||
{ viewType === LAYOUT_LIST && hasMedia && ( | ||
<Media | ||
className="edit-site-page-pages__featured-image" |
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.
Nit: I guess we could have Media
in a constant above as it's identical in both scenarios
{ ! isEmpty && <BlockPreview blocks={ blocks } /> } | ||
</button> | ||
{ viewType === LAYOUT_LIST ? ( | ||
<BlockPreview blocks={ blocks } /> |
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.
Nit: we could also check for isEmpty
before rendering.
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.
Besides a couple of nits, it looks good. Thank you!
@ntsekouras Thanks for the review! I have updated it with fba7764, but could you confirm that your feedback is reflected correctly in the code? |
Yeah, looks good. Thank you! |
Flaky tests detected in fba7764b00e8bc16a8e732f50dc738d9fa7d7644. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7695314918
|
fba7764
to
4cbd8a7
Compare
I wonder if there's an icon-only treatment that works in all layouts we might try. Perhaps one to look into in a follow-up? |
I think this is a good idea and may be able to address it in a follow-up. However, even if I search the icon library, there might not be an icon to represent "empty" or "placeholder" yet 🤔 |
Related to #58071
What?
This PR solves the following two problems with Templates and Pages list layout.
Preview consists of nested buttons
Placeholder text overflows
Why?
Preview consists of nested buttons
When in the list layout, the entire row has a button role. Therefore, the preview inside it should not have been a button element.
Placeholder text overflows
Placeholder text works fine in the grid layout, but in the list layout, the media width is only 32px, so the text cannot be displayed properly.
How?
###Preview consists of nested buttons
When in the list view, unwrap the button element.
Placeholder text overflows
When in the list view, the placeholder text itself is not displayed.
Testing Instructions
Pages
Templates