Making WordPress.org

Changeset 5244


Ignore:
Timestamp:
04/05/2017 01:14:12 AM (8 years ago)
Author:
obenland
Message:

Plugin Directory: Make entire question clickable.

Also simplifies JS callback and removes the need to mess with focus styles.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/section-faq.js

    r5195 r5244  
    77            $question.html( $button.text( $question.text() ) );
    88        } )
    9         .on( 'mousedown keydown', '.button-link', function( event ) {
    10             var $question = $( event.target );
     9        .on( 'click', function( event ) {
     10            var $question = $( event.currentTarget );
    1111
    1212            if ( 'keydown' === event.type && 13 !== event.which ) {
     
    1414            }
    1515
    16             $question.toggleClass( 'no-focus', 'mousedown' === event.type );
    17 
    1816            if ( ! $question.is( '.open' ) ) {
    19                 $question.siblings( '.open' ).toggleClass( 'open' ).attr( 'aria-expanded', false ).parent().next( 'dd' ).slideToggle( 200 );
     17                $question.siblings( '.open' ).toggleClass( 'open' ).attr( 'aria-expanded', false ).next( 'dd' ).slideToggle( 200 );
    2018            }
    2119
    22             $question.parent().toggleClass( 'open' ).attr( 'aria-expanded', function( index, attribute ) {
     20            $question.toggleClass( 'open' ).attr( 'aria-expanded', function( index, attribute ) {
    2321                return 'true' !== attribute;
    2422            } ).next( 'dd' ).slideToggle( 200 );
Note: See TracChangeset for help on using the changeset viewer.