Make WordPress Core


Ignore:
Timestamp:
05/22/2017 08:23:49 PM (7 years ago)
Author:
afercia
Message:

Widgets: Remove the title attributes used in the Tag cloud widget.

  • improves accessibility using an aria-label attribute to match the information conveyed visually with the one exposed to assistive technologies
  • adds an option in the widget to display the item counts, consistently with what other widgets already do (Archives, Categories)

Props adamsoucie, emirpprime, Samantha Miller., MikeLittle, rianrietveld, sami.keijonen, adamsilverstein, westonruter, afercia.
See #24766.
Fixes #35566.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/term/wpGenerateTagCloud.php

    r35988 r40816  
    120120        ) );
    121121
    122         $this->assertRegExp( "|^<ul class='wp-tag-cloud'>|", $found );
     122        $this->assertRegExp( "|^<ul class='wp-tag-cloud' role='list'>|", $found );
    123123        $this->assertRegExp( "|</ul>\n|", $found );
    124124        $this->assertContains( '>' . $tags[0]->name . '<', $found );
     
    165165        ) );
    166166
    167         $this->assertRegExp( "|^<ul class='wp-tag-cloud'>|", $found );
     167        $this->assertRegExp( "|^<ul class='wp-tag-cloud' role='list'>|", $found );
    168168        $this->assertRegExp( "|</ul>\n|", $found );
    169169
     
    199199        ) );
    200200
    201         $this->assertContains( "title='Term has 1 post'", $actual[0] );
    202         $this->assertContains( "title='Term has 2 posts'", $actual[1] );
     201        $this->assertContains( 'aria-label="' . $term_objects[0]->name . ' (Term has 1 post)"', $actual[0] );
     202        $this->assertContains( 'aria-label="' . $term_objects[1]->name . ' (Term has 2 posts)"', $actual[1] );
    203203    }
    204204
     
    224224        ) );
    225225
    226         $this->assertContains( "title='1 foo'", $actual[0] );
    227         $this->assertContains( "title='2 foo'", $actual[1] );
     226        $this->assertContains( 'aria-label="' . $term_objects[0]->name . ' (1 foo)"', $actual[0] );
     227        $this->assertContains( 'aria-label="' . $term_objects[1]->name . ' (2 foo)"', $actual[1] );
    228228    }
    229229
Note: See TracChangeset for help on using the changeset viewer.