From d2a6a73d297470c2ec1a9340fa833bad51751db5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Mon, 2 Mar 2015 10:16:29 +0100 Subject: [PATCH] Hide section anchor links from screen readers using aria-hidden Hide from screen readers, as it is inside a heading (the programs use headings to navigate, so the symbol is being read during navigation). Pending T13555 being fixed. See and for reasoning. Bug: T18691 Change-Id: I736cb7f52d5ce37eb7e8d3a3648ffd0bd40f2c83 --- includes/Linker.php | 3 + tests/parser/parserTests.txt | 260 +++++++++++++++++------------------ 2 files changed, 133 insertions(+), 130 deletions(-) diff --git a/includes/Linker.php b/includes/Linker.php index dd224efd4c..5a05bd4721 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1754,6 +1754,9 @@ class Linker { array( 'href' => '#' . $anchor, 'class' => 'mw-headline-anchor', + // Hide from screen readers, as it is inside a heading (the programs use headings to + // navigate, so the symbol is being read during navigation). Pending T13555 being fixed. + 'aria-hidden' => 'true', 'title' => wfMessage( 'headline-anchor-title' )->text() ), wfMessage( 'section-symbol' )->text() diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index b891676159..dec93389a2 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -425,11 +425,11 @@ a

a


-

§b[edit]

+

b[edit]

a


-

§b[edit]

+

b[edit]

!! end @@ -442,7 +442,7 @@ Extra newlines between heading and content are swallowed [[a]] !! html -

§b[edit]

+

b[edit]

a

!! end @@ -8064,7 +8064,7 @@ List interrupted by empty line or heading !! html
  • foo
    • bar
-

§A heading[edit]

+

A heading[edit]

  • Another list item
!!end @@ -9772,8 +9772,8 @@ Bug 6563: Edit link generation for section shown by !! wikitext {{includeonly section}} !! html -

§Includeonly section[edit]

-

§Section T-1[edit]

+

Includeonly section[edit]

+

Section T-1[edit]

!! end @@ -9799,7 +9799,7 @@ Bug 6563: Edit link generation for section suppressed by ==Section 1== !! html -

§Section 1[edit]

+

Section 1[edit]

!! end @@ -9836,12 +9836,12 @@ some can have stuff=== here === !! html/php -

§hu

+

hu

some

  • stuff
  • here
-

§here

+

here

!! html/parsoid

hu

@@ -13251,13 +13251,13 @@ More ===Smaller headline=== Blah blah !! html -

§Headline 1[edit]

+

Headline 1[edit]

Some text

-

§Headline 2[edit]

+

Headline 2[edit]

More

-

§Smaller headline[edit]

+

Smaller headline[edit]

Blah blah

!! end @@ -13297,14 +13297,14 @@ Some text -

§Headline 1[edit]

-

§Subheadline 1[edit]

-
§Skipping a level[edit]
-
§Skipping a level[edit]
-

§Headline 2[edit]

+

Headline 1[edit]

+

Subheadline 1[edit]

+
Skipping a level[edit]
+
Skipping a level[edit]
+

Headline 2[edit]

Some text

-

§Another headline[edit]

+

Another headline[edit]

!! end @@ -13326,10 +13326,10 @@ __FORCETOC__ -

§Headline 2[edit]

-

§Headline[edit]

-

§Headline 2[edit]

-

§Headline[edit]

+

Headline 2[edit]

+

Headline[edit]

+

Headline 2[edit]

+

Headline[edit]

!! end @@ -13378,16 +13378,16 @@ Handling of sections up to level 6 and beyond -

§Level 1 Heading[edit]

-

§Level 2 Heading[edit]

-

§Level 3 Heading[edit]

-

§Level 4 Heading[edit]

-
§Level 5 Heading[edit]
-
§Level 6 Heading[edit]
-
§= Level 7 Heading=[edit]
-
§== Level 8 Heading==[edit]
-
§=== Level 9 Heading===[edit]
-
§==== Level 10 Heading====[edit]
+

Level 1 Heading[edit]

+

Level 2 Heading[edit]

+

Level 3 Heading[edit]

+

Level 4 Heading[edit]

+
Level 5 Heading[edit]
+
Level 6 Heading[edit]
+
= Level 7 Heading=[edit]
+
== Level 8 Heading==[edit]
+
=== Level 9 Heading===[edit]
+
==== Level 10 Heading====[edit]
!! end @@ -13421,12 +13421,12 @@ TOC regression (bug 9764) -

§title 1[edit]

-

§title 1.1[edit]

-

§title 1.1.1[edit]

-

§title 1.2[edit]

-

§title 2[edit]

-

§title 2.1[edit]

+

title 1[edit]

+

title 1.1[edit]

+

title 1.1.1[edit]

+

title 1.2[edit]

+

title 2[edit]

+

title 2.1[edit]

!! end @@ -13458,12 +13458,12 @@ wgMaxTocLevel=3 -

§title 1[edit]

-

§title 1.1[edit]

-

§title 1.1.1[edit]

-

§title 1.2[edit]

-

§title 2[edit]

-

§title 2.1[edit]

+

title 1[edit]

+

title 1.1[edit]

+

title 1.1.1[edit]

+

title 1.2[edit]

+

title 2[edit]

+

title 2.1[edit]

!! end @@ -13489,11 +13489,11 @@ wgMaxTocLevel=3 -

§Section 1[edit]

-

§Section 1.1[edit]

-

§Section 1.1.1[edit]

-

§Section 1.1.1.1[edit]

-

§Section 2[edit]

+

Section 1[edit]

+

Section 1.1[edit]

+

Section 1.1.1[edit]

+

Section 1.1.1.1[edit]

+

Section 2[edit]

!! end @@ -13504,8 +13504,8 @@ Resolving duplicate section names == Foo bar == == Foo bar == !! html -

§Foo bar[edit]

-

§Foo bar[edit]

+

Foo bar[edit]

+

Foo bar[edit]

!! end @@ -13515,8 +13515,8 @@ Resolving duplicate section names with differing case (bug 10721) == Foo bar == == Foo Bar == !! html -

§Foo bar[edit]

-

§Foo Bar[edit]

+

Foo bar[edit]

+

Foo Bar[edit]

!! end @@ -13535,10 +13535,10 @@ __NOTOC__ {{sections}} ==Section 4== !! html -

§Section 0[edit]

-

§Section 1[edit]

-

§Section 2[edit]

-

§Section 4[edit]

+

Section 0[edit]

+

Section 1[edit]

+

Section 2[edit]

+

Section 4[edit]

!! end @@ -13549,8 +13549,8 @@ __NOEDITSECTION__ ==Section 1== ==Section 2== !! html -

§Section 1

-

§Section 2

+

Section 1

+

Section 2

!! end @@ -13559,7 +13559,7 @@ Link inside a section heading !! wikitext ==Section with a [[Main Page|link]] in it== !! html -

§Section with a link in it[edit]

+

Section with a link in it[edit]

!! end @@ -13582,9 +13582,9 @@ __TOC__ -

§title 1[edit]

-

§title 1.1[edit]

-

§title 2[edit]

+

title 1[edit]

+

title 1.1[edit]

+

title 2[edit]

!! end @@ -13608,10 +13608,10 @@ The line above must have a trailing space! --> But just in case it doesn't... !! html -

§=[edit]

+

=[edit]

The line above must have a trailing space!

-

§=[edit]

+

=[edit]

But just in case it doesn't...

!! end @@ -13648,19 +13648,19 @@ section 5 -

§text > text[edit]

+

text > text[edit]

section 1

-

§text < text[edit]

+

text < text[edit]

section 2

-

§text & text[edit]

+

text & text[edit]

section 3

-

§text ' text[edit]

+

text ' text[edit]

section 4

-

§text " text[edit]

+

text " text[edit]

section 5

!! end @@ -13708,22 +13708,22 @@ section 6 -

§Space between Text[edit]

+

Space between Text[edit]

section 1

-

§Space-Entity between Text[edit]

+

Space-Entity between Text[edit]

section 2

-

§Plus+between+Text[edit]

+

Plus+between+Text[edit]

section 3

-

§Plus-Entity+between+Text[edit]

+

Plus-Entity+between+Text[edit]

section 4

-

§Underscore_between_Text[edit]

+

Underscore_between_Text[edit]

section 5

-

§Underscore-Entity_between_Text[edit]

+

Underscore-Entity_between_Text[edit]

section 6

#Space between Text #Space-Entity between Text @@ -13752,10 +13752,10 @@ Headers with excess '=' characters -

§foo=[edit]

-

§=foo[edit]

-

§italic heading=[edit]

-

§=italic heading[edit]

+

foo=[edit]

+

=foo[edit]

+

italic heading=[edit]

+

=italic heading[edit]

!! end @@ -13790,12 +13790,12 @@ __NOEDITSECTION__ -

§Header 1

-

§Header 1.1

-

§Header 1.2

-

§Header 2

-

§Header 2.1

-

§Header 2.2

+

Header 1

+

Header 1.1

+

Header 1.2

+

Header 2

+

Header 2.1

+

Header 2.2

!! end @@ -13810,9 +13810,9 @@ parsoid=wt2html,wt2wt c2 c3--> !! html -

§foo

-

§bar

-

§baz

+

foo

+

bar

+

baz

!! end @@ -15393,7 +15393,7 @@ Fuzz testing: Parser14 == onmouseover= == http://__TOC__ !! html -

§onmouseover=[edit]

+

onmouseover=[edit]

http://

Contents

  • 1 onmouseover=
  • @@ -15402,7 +15402,7 @@ http://

    Contents

    !! html+tidy -

    §onmouseover=[edit]

    +

    onmouseover=[edit]

    http://

    @@ -15420,13 +15420,13 @@ Fuzz testing: Parser14-table ==a== {| STYLE=__TOC__ !! html -

    §a[edit]

    +

    a[edit]

    !! html+tidy -

    §a[edit]

    +

    a[edit]

    @@ -17435,7 +17435,7 @@ Inclusion of !userCanEdit() content !! wikitext {{MediaWiki:Fake}} !! html -

    §header[edit]

    +

    header[edit]

    !! end @@ -17467,12 +17467,12 @@ Out-of-order TOC heading levels -

    §2[edit]

    -
    §6[edit]
    -

    §3[edit]

    -

    §1[edit]

    -
    §5[edit]
    -

    §2[edit]

    +

    2[edit]

    +
    6[edit]
    +

    3[edit]

    +

    1[edit]

    +
    5[edit]
    +

    2[edit]

    !! end @@ -17579,7 +17579,7 @@ anchorencode encodes like the TOC generator: (bug 18431) {{anchorencode: _ +:.3A%3A&&]] }} __NOEDITSECTION__ !! html -

    §_ +:.3A%3A&&]]

    +

    _ +:.3A%3A&&]]

    .2B:.3A.253A.26.26.5D.5D

    !! end @@ -17829,7 +17829,7 @@ language=sr variant=sr-ec !! wikitext == -{Naslov}- == !! html -

    §Naslov[уреди]

    +

    Naslov[уреди]

    !! end @@ -18219,7 +18219,7 @@ Morwen/13: Unclosed link followed by heading !! html

    [[link

    -

    §heading[edit]

    +

    heading[edit]

    !! end @@ -18231,7 +18231,7 @@ HHP2.1: Heuristics for headings in preprocessor parenthetical structures !! html

    {{foo|

    -

    §heading

    +

    heading

    !! end @@ -18243,7 +18243,7 @@ HHP2.2: Heuristics for headings in preprocessor parenthetical structures !! html

    {{foo|

    -

    §heading[edit]

    +

    heading[edit]

    !! end @@ -19127,7 +19127,7 @@ __TOC__ -

    §Lost episodes[edit]

    +

    Lost episodes[edit]

    !! end @@ -19145,7 +19145,7 @@ __TOC__ -

    §should be bold then normal text[edit]

    +

    should be bold then normal text[edit]

    !! end @@ -19163,7 +19163,7 @@ __TOC__ -

    §Image Foobar.jpg[edit]

    +

    Image Foobar.jpg[edit]

    !! end @@ -19181,7 +19181,7 @@ __TOC__ -

    §
    Quote
    [edit]

    +

    Quote
    [edit]

    !! html+tidy
    @@ -19192,7 +19192,7 @@ __TOC__
  • 1 Quote
  • -

    §

    +

    Quote

    @@ -19215,7 +19215,7 @@ QED -

    §Proof: 2 < 3[edit]

    +

    Proof: 2 < 3[edit]

    Hanc marginis exiguitas non caperet. QED

    @@ -19236,8 +19236,8 @@ __TOC__ -

    §Foo Bar[edit]

    -

    §Foo
    Bar
    [edit]

    +

    Foo Bar[edit]

    +

    Foo
    Bar
    [edit]

    !! html+tidy
    @@ -19249,8 +19249,8 @@ __TOC__
  • 2 Foo Bar
  • -

    §Foo Bar[edit]

    -

    §Foo

    +

    Foo Bar[edit]

    +

    Foo

    Bar

    @@ -19272,8 +19272,8 @@ __TOC__ -

    §Hello[edit]

    -

    § b">Evilbye[edit]

    +

    Hello[edit]

    +

    b">Evilbye[edit]

    !! end @@ -19301,11 +19301,11 @@ __TOC__ -

    §C++[edit]

    -

    §זבנג![edit]

    -

    §The attributes on these span tags must be deleted from the TOC[edit]

    -

    §All attributes on these span tags must be deleted from the TOC[edit]

    -

    §Attributes after dir on these span tags must be deleted from the TOC[edit]

    +

    C++[edit]

    +

    זבנג![edit]

    +

    The attributes on these span tags must be deleted from the TOC[edit]

    +

    All attributes on these span tags must be deleted from the TOC[edit]

    +

    Attributes after dir on these span tags must be deleted from the TOC[edit]

    !! end @@ -19321,7 +19321,7 @@ __TOC__ -

    §test[edit]

    +

    test[edit]

    !! end @@ -19338,7 +19338,7 @@ title=[[Main Page]] !! wikitext {{int:Bug32057}} !! html -

    §Headline text[edit]

    +

    Headline text[edit]

    !! end @@ -19453,7 +19453,7 @@ nowiki inside link inside heading (bug 18295) !! wikitext ==[[foo|xyz]]== !! html -

    §xyz[edit]

    +

    xyz[edit]

    !! end @@ -19638,11 +19638,11 @@ Lead

    Lead

    -

    §Section 1[edit]

    -

    §Section 2[edit]

    -

    §Section 3[edit]

    -

    §Section 4[edit]

    -

    §Section 5[edit]

    +

    Section 1[edit]

    +

    Section 2[edit]

    +

    Section 3[edit]

    +

    Section 4[edit]

    +

    Section 5[edit]

    !! end -- 2.20.1