[wp-trac] [WordPress Trac] #63581: paginate_links: The current page should be an a element, not a span element

WordPress Trac noreply at wordpress.org
Tue Jun 17 09:06:18 UTC 2025


#63581: paginate_links: The current page should be an a element, not a span element
---------------------------+-----------------------------
 Reporter:  wildworks      |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  General        |    Version:
 Severity:  normal         |   Keywords:
  Focuses:  accessibility  |
---------------------------+-----------------------------
 Originally reported at
 [https://github.com/WordPress/gutenberg/issues/70439 GB 70439]

 The `paginate_links` function outputs the current page as a span element.
 Example:

 {{{
 echo ( array( 'current' => 1, 'total' => 10 ) );

 <span aria-current="page" class="page-numbers current">1</span>
 <a class="page-numbers" href="">2</a>
 <a class="page-numbers" href="">3</a>
 <span class="page-numbers dots">…</span>
 <a class="page-numbers" href="">10</a>
 <a class="next page-numbers" href="">Next »</a>
 }}}

 However, this may cause an accessibility problem for screen reader users,
 as the current page is not focusable.

 Ideally, the HTML markup should be:

 {{{
 <a aria-current="page" class="page-numbers current" href="">1</a>
 <a class="page-numbers" href="">2</a>
 <a class="page-numbers" href="">3</a>
 <span class="page-numbers dots">…</span>
 <a class="page-numbers" href="">10</a>
 <a class="next page-numbers" href="">Next »</a>
 }}}

 However, this change will impact many themes that include a span element
 as part of their CSS selectors.

 I would like to clarify whether the current HTML really has problems from
 the viewpoint of accessibility in the first place. I look forward to
 feedback from people who are knowledgeable about accessibility.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63581>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list