WordPress.org

Making WordPress.org

Changeset 3726


Ignore:
Timestamp:
07/26/2016 05:25:49 PM (5 years ago)
Author:
coffee2code
Message:

Handbook plugin: Add screen reader text to the table of contents section anchors.

Props keesiemeijer.
Fixes #1861.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/table-of-contents.php

    r3708 r3726  
    119119                $first = false;
    120120            }
    121 
    122             $replacement .= sprintf( '<%1$s class="toc-heading" id="%2$s" tabindex="-1">%3$s <a href="#%2$s" class="anchor">#</a></%1$s>', $tag, $id, $item[2] );
     121            $a11y_text      = sprintf( '<span class="screen-reader-text">%s</span>', $item[2] );
     122            $anchor         = sprintf( '<a href="#%1$s" class="anchor"><span aria-hidden="true">#</span>%2$s</a>', $id, $a11y_text );
     123            $replacement   .= sprintf( '<%1$s class="toc-heading" id="%2$s" tabindex="-1">%3$s %4$s</%1$s>', $tag, $id, $item[2], $anchor );
    123124            $replacements[] = $replacement;
    124125        }
Note: See TracChangeset for help on using the changeset viewer.