Make WordPress Core

Ticket #53951: 53951.3.diff

File 53951.3.diff, 2.1 KB (added by alexstine, 3 years ago)
  • src/wp-content/themes/twentytwenty/assets/js/index.js

    diff --git a/src/wp-content/themes/twentytwenty/assets/js/index.js b/src/wp-content/themes/twentytwenty/assets/js/index.js
    index 0a64fd98ba..f059e13636 100644
    a b twentytwentyDomReady( function() { 
    678678/* Toggle an attribute ----------------------- */
    679679
    680680function twentytwentyToggleAttribute( element, attribute, trueVal, falseVal ) {
     681        var toggles;
     682
    681683        if ( element.classList.contains( 'close-search-toggle' ) ) {
    682684                return;
    683685        }
    function twentytwentyToggleAttribute( element, attribute, trueVal, falseVal ) { 
    687689        if ( falseVal === undefined ) {
    688690                falseVal = false;
    689691        }
    690         if ( element.getAttribute( attribute ) !== trueVal ) {
    691                 element.setAttribute( attribute, trueVal );
    692         } else {
    693                 element.setAttribute( attribute, falseVal );
    694         }
     692
     693        /*
     694         * Take into account multiple toggle elements that need their state to be
     695         * synced. For example: the Search toggle buttons for desktop and mobile.
     696         */
     697        toggles = document.querySelectorAll( '[data-toggle-target="' + element.dataset.toggleTarget + '"]' );
     698
     699        toggles.forEach( function( toggle ) {
     700                if ( toggle.classList.contains( 'close-search-toggle' ) ) {
     701                        return;
     702                }
     703                if ( toggle.getAttribute( attribute ) !== trueVal ) {
     704                        toggle.setAttribute( attribute, trueVal );
     705                } else {
     706                        toggle.setAttribute( attribute, falseVal );
     707                }
     708        } );
    695709}
    696710
    697711/**
  • src/wp-content/themes/twentytwenty/template-parts/modal-search.php

    diff --git a/src/wp-content/themes/twentytwenty/template-parts/modal-search.php b/src/wp-content/themes/twentytwenty/template-parts/modal-search.php
    index 32f9b51a0c..cf8d4dc6a7 100644
    a b  
    88 */
    99
    1010?>
    11 <div class="search-modal cover-modal header-footer-group" data-modal-target-string=".search-modal">
     11<div class="search-modal cover-modal header-footer-group" data-modal-target-string=".search-modal" role="dialog" aria-modal="true" aria-label="<?php esc_attr_e( 'Search', 'twentytwenty' ); ?>">
    1212
    1313        <div class="search-modal-inner modal-inner">
    1414