WordPress.org

Make WordPress Core

Changeset 46778


Ignore:
Timestamp:
11/25/2019 11:18:04 AM (10 months ago)
Author:
SergeyBiryukov
Message:

Accessibility: Media: Add an aria-pressed attribute to active button within a button group.

The aria-pressed attribute communicates semantically the "active" state of buttons that otherwise only look "active".

Props afercia.
Merges [46748] to the 5.3 branch.
Fixes #48355.

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/src/js/media/views/settings.js

    r43309 r46778  
    7070        // Handle button groups.
    7171        } else if ( $setting.hasClass('button-group') ) {
    72             $buttons = $setting.find('button').removeClass('active');
    73             $buttons.filter( '[value="' + value + '"]' ).addClass('active');
     72            $buttons = $setting.find( 'button' )
     73                .removeClass( 'active' )
     74                .attr( 'aria-pressed', 'false' );
     75            $buttons.filter( '[value="' + value + '"]' )
     76                .addClass( 'active' )
     77                .attr( 'aria-pressed', 'true' );
    7478
    7579        // Handle text inputs and textareas.
Note: See TracChangeset for help on using the changeset viewer.