Make WordPress Core

Changeset 46748


Ignore:
Timestamp:
11/18/2019 10:21:26 PM (5 years ago)
Author:
afercia
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".

Fixes #48355.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/media/views/settings.js

    r43309 r46748  
    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.