Skip to content

Administration: Add hierarchy descriptions to page row titles#12394

Closed
Maxerns wants to merge 11 commits into
WordPress:trunkfrom
Maxerns:chore/admin-hirearchy-desc
Closed

Administration: Add hierarchy descriptions to page row titles#12394
Maxerns wants to merge 11 commits into
WordPress:trunkfrom
Maxerns:chore/admin-hirearchy-desc

Conversation

@Maxerns

@Maxerns Maxerns commented Jul 2, 2026

Copy link
Copy Markdown

Adds accessible hierarchy information to child page row titles in the Pages list table.

The visual dash prefix is moved outside the title link and marked aria-hidden, keeping the link’s accessible name aligned with its visible title. Child page links now reference a hidden description with aria-describedby, using the immediate parent title.

Adds PHPUnit coverage for:

  • child page row titles including an aria-describedby hierarchy description
  • top-level page row titles not receiving hierarchy descriptions

Trac ticket: https://core.trac.wordpress.org/ticket/64932

Testing

Passed:

  • npm run test:php -- --filter Tests_Admin_wpPostsListTable tests/phpunit/tests/admin/wpPostsListTable.php
  • npm run test:php -- --group 64932
  • git diff --check

Use of AI Tools

AI assistance: yes.
Tool(s): Codex
Model(s): GPT-5.5
Used for: Test additions

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Hi there! 👋

Thank you for your contribution to WordPress! 💖

It looks like this is your first pull request to wordpress-develop. Here are a few things to be aware of that may help you out!

No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description.

Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making.

More information about how GitHub pull requests can be used to contribute to WordPress can be found in the Core Handbook.

Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook.

If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook.

The Developer Hub also documents the various coding standards that are followed:

Thank you,
The WordPress Project

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @Maxerns.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

Core Committers: Use this line as a base for the props when committing in SVN:

Props joedolson, sabernhardt.

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 commented Jul 2, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@sabernhardt sabernhardt left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the second commit, which contains unrelated changes for the REST API.

I also suggested a small edit to the printf() function.

if ( $can_edit_post && 'trash' !== $post->post_status ) {
printf(
'<a class="row-title" href="%s">%s%s</a>',
'%2$s<a class="row-title" href="%1$s"%3$s>%4$s</a>%5$s',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these could be rearranged so the numbers are in order, not using %2$s before %1$s.

				'%1$s<a class="row-title" href="%2$s"%3$s>%4$s</a>%5$s',
				$pad,
				get_edit_post_link( $post->ID ),

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot, i've updated it now

@Maxerns
Maxerns force-pushed the chore/admin-hirearchy-desc branch from a0c296c to 1de3afa Compare July 7, 2026 20:11
@Maxerns
Maxerns requested a review from sabernhardt July 7, 2026 20:53

@sabernhardt sabernhardt left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch should be refreshed to trunk, but the changes seem good.

Test Report

Patch tested: PR 12394 as of commit 303135e
Note: I created a branch on my fork from this pull request and updated the branch to trunk. The .diff file from GitHub did not apply to my SVN site because it does not include changes from r62685.

Environment

  • WordPress: 7.1-alpha-62161-src
  • Subdirectory: No
  • PHP: 8.3.14
  • Server: Apache/2.4.62 (Win64) PHP/8.3.14 mod_fcgid/2.3.10-dev
  • Database: mysqli (Server: 9.1.0 / Client: mysqlnd 8.3.14)
  • Browser: Firefox 152.0 with NVDA 2026.1.1
  • OS: Windows 11
  • Theme: Twenty Fifteen 4.2
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.3.0

Steps taken

  1. Create a page plus child pages at multiple levels.
  2. Create a hierarchical custom post type and add posts with multiple levels.
  3. Use a screen reader to hear the links and their related text when the page or post has a parent.

Results

  • ✅ Adds "Child of" context to links for child pages, as well as for child posts in hierarchical custom post types.
  • ✅ Does not add the span or ARIA attribute when a page does not have a parent, or when the post type is non-hierarchical.
  • ✅ Updates markup in Quick Edit without refreshing the page.

Pages

List of 3 nested pages

Parent page visited link
Child page visited link Child of Parent page
Grandchild page visited link Child of Child page

<strong><a class="row-title" href="http://localhost/dev/src/wp-admin/post.php?post=1981&amp;action=edit">Parent page</a></strong>

<strong><span aria-hidden="true">&#8212;</span> <a class="row-title" href="http://localhost/dev/src/wp-admin/post.php?post=1983&amp;action=edit" aria-describedby="post-hierarchy-1983">Child page</a><span id="post-hierarchy-1983" class="hidden">Child of Parent page</span></strong>

<strong><span aria-hidden="true">&#8212;</span> <span aria-hidden="true">&#8212;</span> <a class="row-title" href="http://localhost/dev/src/wp-admin/post.php?post=1985&amp;action=edit" aria-describedby="post-hierarchy-1985">Grandchild page</a><span id="post-hierarchy-1985" class="hidden">Child of Child page</span></strong>

Hierarchical custom post type

custom Animal post type with three hierarchical posts

Pets visited link
Dogs visited link Child of Pets
Labrador visited link Child of Pets

<strong><a class="row-title" href="http://localhost/dev/src/wp-admin/post.php?post=1987&amp;action=edit">Pets</a></strong>

<strong><span aria-hidden="true">&#8212;</span> <a class="row-title" href="http://localhost/dev/src/wp-admin/post.php?post=1988&amp;action=edit" aria-describedby="post-hierarchy-1988">Dogs</a><span id="post-hierarchy-1988" class="hidden">Child of Pets</span></strong>

<strong><span aria-hidden="true">&#8212;</span> <span aria-hidden="true">&#8212;</span> <a class="row-title" href="http://localhost/dev/src/wp-admin/post.php?post=1989&amp;action=edit" aria-describedby="post-hierarchy-1989">Labrador</a><span id="post-hierarchy-1989" class="hidden">Child of Dogs</span></strong>

Posts (and non-heirarchical custom post types)

Standard post title link in posts list

Standard post visited link

<strong><a class="row-title" href="http://localhost/dev/src/wp-admin/post.php?post=1979&amp;action=edit">Standard post</a></strong>

Copilot AI review requested due to automatic review settings July 21, 2026 16:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves accessibility of hierarchical Page titles in the admin list table by keeping the row title link’s accessible name aligned with its visible title, while adding a hierarchy description for child pages via aria-describedby.

Changes:

  • Moves the visual hierarchy dash prefix outside the title link and marks it aria-hidden.
  • Adds a per-row aria-describedby reference to a generated hierarchy description (“Child of {Parent}”).
  • Adds PHPUnit coverage for child vs. top-level page row title output (plus a helper for capturing list table output).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/wp-admin/includes/class-wp-posts-list-table.php Adjusts page row title markup to add an accessible hierarchy description and to make the dash prefix decorative (aria-hidden).
tests/phpunit/tests/admin/wpPostsListTable.php Adds PHPUnit assertions (and a helper) validating the new hierarchy description behavior for child vs. top-level pages.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/wp-admin/includes/class-wp-posts-list-table.php
Comment thread src/wp-admin/includes/class-wp-posts-list-table.php
Comment thread tests/phpunit/tests/admin/wpPostsListTable.php
Comment thread tests/phpunit/tests/admin/wpPostsListTable.php
Copilot AI review requested due to automatic review settings July 21, 2026 21:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread src/wp-admin/includes/class-wp-posts-list-table.php
Comment thread src/wp-admin/includes/class-wp-posts-list-table.php Outdated
Comment thread src/wp-admin/includes/class-wp-posts-list-table.php Outdated
Copilot AI review requested due to automatic review settings July 21, 2026 21:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/wp-admin/includes/class-wp-posts-list-table.php Outdated
@joedolson

Copy link
Copy Markdown
Contributor

Added a couple of changes: one to strip tags before printing HTML inside the span, and one to extend coverage onto posts without links, which requires a different mechanism to expose the information.

@joedolson

Copy link
Copy Markdown
Contributor

@Maxerns If you can link your Github profile to a WordPress profile (https://profiles.wordpress.org), I can give you props; as it is, I'm unable to link your account. I'm going to cite your Github handle; but I can change the props later, if you provide a WordPress profile handle.

Copilot AI review requested due to automatic review settings July 21, 2026 22:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 21, 2026 22:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

pento pushed a commit that referenced this pull request Jul 21, 2026
In post list tables, subpages within hierarchical post types were visibly marked using an em dash to represent their nesting position. This information was not communicated in any way to screen reader users. Add `aria-describedby` with associated descriptive text to linked post titles, and screen reader text for non-editable post title contexts.

Developed in #12394

Props juliemoynat, audrasjb, ekaterina92, ishikaatxecurify, aion11, sabernhardt, maxerns, joedolson.
Fixes #64932.

git-svn-id: https://develop.svn.wordpress.org/trunk@62814 602fd350-edb4-49c9-b593-d223f7449a82
@github-actions

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 62814
GitHub commit: 35e63f8

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Jul 21, 2026
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Jul 21, 2026
In post list tables, subpages within hierarchical post types were visibly marked using an em dash to represent their nesting position. This information was not communicated in any way to screen reader users. Add `aria-describedby` with associated descriptive text to linked post titles, and screen reader text for non-editable post title contexts.

Developed in WordPress/wordpress-develop#12394

Props juliemoynat, audrasjb, ekaterina92, ishikaatxecurify, aion11, sabernhardt, maxerns, joedolson.
Fixes #64932.
Built from https://develop.svn.wordpress.org/trunk@62814


git-svn-id: http://core.svn.wordpress.org/trunk@62094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants