Open richtabor opened 4 months ago
cc @jameskoster for design feedback. 🙏
This seems a bit related to https://github.com/WordPress/gutenberg/issues/57072 in that it helps you quickly identify when a view is empty.
Hiding empty views should probably be a component-level change. In that respect would you also expect empty pattern categories to be hidden? What if there are no posts at all, should the "All posts" view be hidden? That one feels like an exception.
How about if you filter a view so that it becomes empty, does it disappear from the sidebar? 🤔
We should also consider custom views. If they're hidden when empty, users might mistakenly think the view they created has been deleted. Similarly if you create a view that returns no results, there would be no way to access the view to edit it's properties.
I like how this would tidy up the UI, but there are a few tricky nuances to consider.
In that respect would you also expect empty pattern categories to be hidden?
Yes, I would. I think they are hidden, at least in the Inserter.
What if there are no posts at all, should the "All posts" view be hidden? That one feels like an exception.
Yes, this is the exception. Here's WP Admin > Posts, with no posts:
How about if you filter a view so that it becomes empty, does it disappear from the sidebar? 🤔
Perhaps we're too liberal with allowing removal of filters when a view is configured—at least on core-supplied views. Otherwise, if I remove the "Scheduled" filter, when I'm viewing scheduled posts, I'm not viewing scheduled posts anymore, even though the UI indicates that I am.
We should also consider custom views.
I'd probably treat custom views like "All" — always there. If you manipulate a filter there and save it, it's yours. You can rename the view too, so you don't get stuck in the scenario above.
Perhaps we're too liberal with allowing removal of filters when a view is configured—at least on core-supplied views
Absolutely. That will be fixed by https://github.com/WordPress/gutenberg/issues/60472 and https://github.com/WordPress/gutenberg/issues/60468.
However, what if you filter the Scheduled view by an author with no scheduled pages? The count will be zero, but the view still visible.
I'd probably treat custom views like "All" — always there
Agreed.
TLDR I suppose the logic goes:
For views except "All pages" and any custom/customised views, hide the menu item when count = 0, unless the count = 0 due to customised filters. What do you think?
For views except "All pages" and any custom/customised views, hide the menu item when count = 0, unless the count = 0 due to customised filters. What do you think?
Yes, that'll work.
I'm pulling from how WP Admin > Pages view works, where the link to the"Pending Review" filtered view is rendered only if there are posts that are set to pending review.
I think we should map that same functionality to each of the statuses in the Site Editor > Pages view.
I.e. if a view renders no results, it should not be available.
Visuals