Make WordPress Core

Changeset 30374


Ignore:
Timestamp:
11/18/2014 03:33:11 AM (10 years ago)
Author:
johnbillion
Message:

Improve keyboard control of Edit Selection mode in the media manager.

See #29326
Props adamsilverstein

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/css/media-views.css

    r30359 r30374  
    926926
    927927.attachment .close {
    928     display: none;
     928    display: block;
    929929    position: absolute;
    930930    top: 5px;
     
    945945    -webkit-box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.3 );
    946946    box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.3 );
    947 }
    948 
    949 .attachment .close:hover {
     947    transition-duration: none;
     948    transition-property: none;
     949}
     950
     951.attachment a.close:hover,
     952.attachment a.close:focus {
    950953    -webkit-box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.6 );
    951954    box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.6 );
    952 }
    953 
    954 .attachment:hover .close {
    955     display: block;
     955    background-position: -36px 4px;
     956
    956957}
    957958
  • trunk/src/wp-includes/js/media-views.js

    r30245 r30374  
    30173017            // Browse our library of attachments.
    30183018            this.content.set( view );
     3019
     3020            // Trigger the controller to set focus
     3021            view.controller.trigger( 'edit:selection', this );
    30193022        },
    30203023
     
    50975100            'click .check':                   'checkClickHandler',
    50985101            'click a':                        'preventDefault',
     5102            'keydown .close':                 'removeFromLibrary',
    50995103            'keydown':                        'toggleSelectionHandler'
    51005104        },
     
    55385542         */
    55395543        removeFromLibrary: function( event ) {
     5544            // Catch enter and space events
     5545            if ( 'keydown' === event.type && 13 !== event.keyCode && 32 !== event.keyCode ) {
     5546                return;
     5547            }
     5548
    55405549            // Stop propagation so the model isn't selected.
    55415550            event.stopPropagation();
     
    62376246
    62386247            this.listenTo( this.controller, 'toggle:upload:attachment', _.bind( this.toggleUploader, this ) );
    6239 
     6248            this.controller.on( 'edit:selection', this.editSelection );
    62406249            this.createToolbar();
    62416250            if ( this.options.sidebar ) {
     
    62566265            this.collection.on( 'add remove reset', this.updateContent, this );
    62576266        },
     6267
     6268        editSelection: function( modal ) {
     6269            modal.$el.find( '.media-button-backToLibrary' ).focus();
     6270        },
     6271
    62586272        /**
    62596273         * @returns {wp.media.view.AttachmentsBrowser} Returns itself to allow chaining
Note: See TracChangeset for help on using the changeset viewer.