-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Page list Block] Show untitled pages on page list on the editor #48772
Conversation
Size Change: +58 B (0%) Total Size: 1.34 MB
ℹ️ View Unchanged
|
Flaky tests detected in 03125db. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4342851288
|
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 think you could try and make the label fall back to no title here:
label: page.title?.rendered, |
so the block list has the fallback label. It would work b/c users can't change it anyway.
// translators: displayed when a page has an empty title. | ||
page.title?.rendered !== '' | ||
? page.title?.rendered | ||
: __( '(No title)' ), |
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.
Question: should we use _x()
here in order to provide context about this?
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 thought the comment was enough? I just saw it used like that in other places
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 think it should be lower case (no title)
to match other times we do similar things.
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.
This works well in the editor.
the frontend won't show any text for these pages.
I don't understand why we would do this? It seems to go against the principle of matching the rendered output of the editor with the front of the site. Is there a reason why we wouldn't do the same on the front of the site?
That's up for discussion, but I'm hesitant to change existing sites' behavior. This change is more about letting the user know that there's something they need to act on. Maybe we should make these look more like placeholders, but they are really not. When a page list with untitled pages gets transformed into links, these pages turn into placeholders with /cc @richtabor what do you think? |
My hesitation as well. Partly the reason I was thinking to omit untitled page items from nav altogether — instead of showing them where they're not visible on the front-end. Once you edit the Page List block, turning them into individual Page List Items, these page links have no title (placeholder of "Add label..."), and therefore don't render on the front-end. The "(No title)" is helpful (that you don't have invisible list items messing with the navigation structure) but one still has to break apart the Page List block, then remove those manually (or add a label then). |
What if we keep the |
then we are still going to have the padding problem that Rich was mentioning in #48226 |
Can we change the output in the editor to avoid the padding problem? |
03125db
to
2a6780f
Compare
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 think the overarching goal is to empower users to edit their pages (titles, order) from the site navigation directly. In that sense I think we should show the no title label in the editor even though it is not rendered on the front end. It is also matching what links with no text do: it says "add text" in the editor and they're not rendered on the front end.
@@ -80,7 +80,7 @@ export default function PageListItemEdit( { context, attributes } ) { | |||
} ) } | |||
href={ link } | |||
> | |||
{ decodeEntities( label ) } | |||
{ decodeEntities( title ) } |
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.
do we not need this too on line 70?
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.
yeah we do, good catch.
What?
This PR adds a
(No title)
label for page list items that are untitled, so they are visible to the user and don't create confusing spaces due to padding on empty tags. This change is also done for the editor, the frontend won't show any text for these pages.Closes #48226
Why?
It's hard for the user to know they have an untitled page on their menu unless they are looking at the list view, this makes it more apparent and it's in line with how untitled pages are displayed on wp-admin.
How?
We change the label for the items that have an empty string as content.
Testing Instructions
Screenshots or screencast
Frontend:
Editor: