WordPress.org

Make WordPress Core

Ticket #38532: 38532.2.diff

File 38532.2.diff, 4.7 KB (added by sirbrillig, 3 years ago)

Updated patch to shorten selectors

  • src/wp-includes/css/customize-preview.css

    diff --git src/wp-includes/css/customize-preview.css src/wp-includes/css/customize-preview.css
    index a388488..1bab796 100644
     
    1212}
    1313
    1414/* Make shortcut buttons essentially invisible */
    15 .widget button.customize-partial-edit-shortcut,
     15.widget .customize-partial-edit-shortcut,
    1616.customize-partial-edit-shortcut {
    1717        position: relative;
    1818        float: left;
     
    2828        z-index: 5;
    2929}
    3030
    31 .customize-partial-edit-shortcut:active {
     31.widget .customize-partial-edit-shortcut button:active,
     32.customize-partial-edit-shortcut button:active {
    3233        padding: 0;
    3334        border: 0;
    3435}
    3536
    3637/* Styles for the actual shortcut */
    37 .customize-partial-edit-shortcut:before {
     38.widget .customize-partial-edit-shortcut button,
     39.customize-partial-edit-shortcut button {
    3840        position: absolute;
    3941        left: -36px;
    4042        color: #fff;
    41         width: 30px;
    42         height: 30px;
     43        min-width: 30px;
     44        min-height: 30px;
    4345        font-size: 18px;
    44         font-family: dashicons;
    45         content: '\f464';
    4646        z-index: 5;
    4747        background-color: #0085ba;
     48        background: #0085ba;
    4849        border-radius: 50%;
    4950        border: 2px solid #fff;
    5051        box-shadow: 0 2px 1px rgba(46,68,83,0.15);
     
    6566                     -1px 0 1px #006799;
    6667}
    6768
    68 .customize-partial-edit-shortcut:hover:before,
    69 .customize-partial-edit-shortcut:focus:before {
     69.customize-partial-edit-shortcut button svg {
     70        fill: #fff;
     71        min-width: 20px;
     72        min-height: 20px;
     73}
     74
     75.customize-partial-edit-shortcut button:hover,
     76.customize-partial-edit-shortcut button:focus {
    7077    background: #008ec2; /* matches primary buttons */
    7178        border-color: #191e23; /* provides visual focus style with 4.5 contrast against background color */
    7279}
    7380
    74 body.customize-partial-edit-shortcuts-shown .customize-partial-edit-shortcut:before {
     81body.customize-partial-edit-shortcuts-shown .customize-partial-edit-shortcut button {
    7582        animation-name: customize-partial-edit-shortcut-bounce-appear;
    7683        pointer-events: auto;
    7784}
    78 body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut:before {
     85body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut button {
    7986        animation-name: customize-partial-edit-shortcut-bounce-disappear;
    8087        pointer-events: none;
    8188}
    8289
    83 body.customize-partial-edit-shortcuts-flash .customize-partial-edit-shortcut:before {
     90body.customize-partial-edit-shortcuts-flash .customize-partial-edit-shortcut button {
    8491        animation-duration: 1.5s;
    8592        animation-delay: 0.4s;
    8693        animation-name: customize-partial-edit-shortcut-bounce-disappear;
    8794        pointer-events: none;
    8895}
    8996
    90 .page-sidebar-collapsed .customize-partial-edit-shortcut:before,
    91 .customize-partial-edit-shortcut-hidden:before {
     97.page-sidebar-collapsed .customize-partial-edit-shortcut button,
     98.customize-partial-edit-shortcut-hidden .customize-partial-edit-shortcut button {
    9299        visibility: hidden;
    93100}
    94101
    95 .customize-partial-edit-shortcut-left-margin:before {
     102.customize-partial-edit-shortcut-left-margin .customize-partial-edit-shortcut button {
    96103        left: 0;
    97104}
    98105
    body.customize-partial-edit-shortcuts-flash .customize-partial-edit-shortcut:bef 
    151158}
    152159
    153160@media screen and (max-width:800px) {
    154         .customize-partial-edit-shortcut:before {
     161        .customize-partial-edit-shortcut button {
    155162                left: -18px; /* Assume there will be less of a margin available on smaller screens */
    156163        }
    157164}
  • src/wp-includes/js/customize-selective-refresh.js

    diff --git src/wp-includes/js/customize-selective-refresh.js src/wp-includes/js/customize-selective-refresh.js
    index 0fc06e9..d4523d9 100644
    wp.customize.selectiveRefresh = ( function( $, api ) { 
    214214                 * @return {jQuery} The edit shortcut button element.
    215215                 */
    216216                createEditShortcut: function() {
    217                         var partial = this, shortcutTitle;
     217                        var partial = this, shortcutTitle, $buttonContainer, $button, $image;
    218218                        shortcutTitle = partial.getEditShortcutTitle();
    219                         return $( '<button>', {
     219                        $buttonContainer = $( '<span>', {
     220                                'class': 'customize-partial-edit-shortcut ' + partial.getEditShortcutClassName()
     221                        } );
     222                        $button = $( '<button>', {
    220223                                'aria-label': shortcutTitle,
    221224                                'title': shortcutTitle,
    222                                 'type': 'button',
    223                                 'class': 'customize-partial-edit-shortcut ' + partial.getEditShortcutClassName()
     225                                'class': 'customize-partial-edit-shortcut-button'
    224226                        } );
     227                        $image = $( '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M13.89 3.39l2.71 2.72c.46.46.42 1.24.03 1.64l-8.01 8.02-5.56 1.16 1.16-5.58s7.6-7.63 7.99-8.03c.39-.39 1.22-.39 1.68.07zm-2.73 2.79l-5.59 5.61 1.11 1.11 5.54-5.65zm-2.97 8.23l5.58-5.6-1.07-1.08-5.59 5.6z"/></svg>' );
     228                        $button.append( $image );
     229                        $buttonContainer.append( $button );
     230                        return $buttonContainer;
    225231                },
    226232
    227233                /**