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 Parent Page Select Dropdown by Adding Page ID When Searching #65501

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

nate-allen
Copy link

What?

This PR improves the Parent Page select dropdown in the block editor by adding the page ID next to the page title when performing a search. The hierarchical tree format is preserved when not searching, ensuring clarity in both scenarios.

Why?

When selecting a parent page in the block editor, pages are displayed hierarchically, making it easy to distinguish between pages with the same name. However, when a search is performed, this hierarchy is lost, and only page titles are shown, leading to confusion when multiple pages share the same title.

This PR addresses issue #65500.

How?

The PageAttributesParent component has been updated to append the page ID next to the page title when a search is performed. When not searching, the existing hierarchical structure is maintained, so there is no disruption to the current user experience.

Testing Instructions

  1. Open the block editor and create or edit a page.
  2. In the Page Attributes panel, open the Parent Page dropdown.
  3. Without searching, observe that the parent pages are displayed in a hierarchical format.
  4. Perform a search by typing part of a page name into the dropdown’s search field.
  5. Observe that the page titles now include the page ID next to the title in parentheses, e.g., Consulting (ID: 42).
  6. Select a parent page and save the page to ensure the selected parent is saved correctly.

Testing Instructions for Keyboard

  1. Open the block editor and navigate to the Page Attributes panel using the keyboard.
  2. Focus on the Parent Page dropdown.
  3. Without searching, use the keyboard to navigate through the hierarchical structure.
  4. Type in the search field to search for a page, and navigate through the results to observe that the IDs are displayed next to the page titles.
  5. Use the keyboard to select a parent page and save the changes, ensuring that everything works as expected without requiring a mouse.

Screenshots or screencast

Before
Screenshot 2024-09-19 at 4 13 21 PM

After
Screenshot 2024-09-19 at 4 26 29 PM

In the block editor, when searching for a parent page, the hierarchical context is lost and only page titles are shown. This can lead to confusion when multiple pages have the same name.

This commit enhances the usability of the Parent Page select dropdown by appending the page ID next to the page title when performing a search. This allows users to easily differentiate between pages with the same name. The hierarchical tree format is preserved when not searching to maintain clarity in non-search scenarios.

Fixes WordPress#65500
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: nate-allen <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Sep 19, 2024
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @nate-allen! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant