Skip to content
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

Improve the DocumentBar post type label for the Homepage and Posts Page cases #66320

Closed
2 tasks done
afercia opened this issue Oct 22, 2024 · 2 comments · Fixed by #66355
Closed
2 tasks done

Improve the DocumentBar post type label for the Homepage and Posts Page cases #66320

afercia opened this issue Oct 22, 2024 · 2 comments · Fixed by #66355
Assignees
Labels
Needs Design Feedback Needs general design feedback. [Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Oct 22, 2024

Description

#65170 added a 'post type label' to the DocumentBar and removed the type icon to provide a clearer information about the object being edited. So far so good. Screenshot:

Image

There are at least two edge cases though where other parts of the UI use a special label for the object being edited: The 'Homepage' and 'Posts Page' pages.

In this cases, while the DocumentBar still says just 'Page', the PostCardPanel in the Settings panel adds a more specific label to these special pages.

As such, users see two inconsistent pieces of information, which is confusing, and may think something is going wrong.

Screenshots:

Image

Image

I'd suggest to provide a consistent information and make the Document Bar handle these special cases by providing a consistent label:

  • Homepage
  • Posts Page

Step-by-step reproduction instructions

  • Go to the wp-admin Reading Settings.
  • Set your homepage to display a static page.
  • Set a Posts page.
  • Go to the Site editor > Pages.
  • Select either the page used tor the homepage or the one used tor the posts page.
  • Observe the Document Bar label is 'Page'.
  • Observe the Post card in the settings panel uses a more specific label: 'Homepage' or 'Posts page'.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes
@afercia afercia added the [Type] Bug An existing feature does not function as intended label Oct 22, 2024
@afercia
Copy link
Contributor Author

afercia commented Oct 22, 2024

Noting that the PostCardPanel uses some hardcoded checks to determine the label based on isFrontPage or isPostsPage.

A similar check is in place in usePostFields, which is is used in the data views posts list:

Image

Instead of hardcoding a new, third check I'd suggest to explore how to abstract this logic into a small utility and reuse it where needed.

@hbhalodia
Copy link
Contributor

Hi @afercia, I have raised the potential PR to fix the hardcoding, however I noticed that data-views are in whole different package, which could not be used inside another package. So I had prevent updating the post fields component, and updated post-card-panel and document bar to resuse the same logic to display the badge.

Thank You,

@afercia afercia added [Package] Editor /packages/editor Needs Design Feedback Needs general design feedback. labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Design Feedback Needs general design feedback. [Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended
Projects
None yet
2 participants