diff -r 34716fd837a4 -r be944660c56a wp/wp-admin/js/theme.js --- a/wp/wp-admin/js/theme.js Tue Dec 15 15:52:01 2020 +0100 +++ b/wp/wp-admin/js/theme.js Wed Sep 21 18:19:35 2022 +0200 @@ -73,7 +73,7 @@ this.SearchView = options.SearchView ? options.SearchView : themes.view.Search; // Bind to the scroll event and throttle // the results from this.scroller. - this.window.bind( 'scroll', _.throttle( this.scroller, 300 ) ); + this.window.on( 'scroll', _.throttle( this.scroller, 300 ) ); }, // Main render control. @@ -404,11 +404,7 @@ var data = this.model.toJSON(); // Render themes using the html template. - this.$el.html( this.html( data ) ).attr({ - tabindex: 0, - 'aria-describedby' : data.id + '-action ' + data.id + '-name', - 'data-slug': data.id - }); + this.$el.html( this.html( data ) ).attr( 'data-slug', data.id ); // Renders active theme styles. this.activeTheme(); @@ -550,7 +546,7 @@ // Render and append. preview.render(); this.setNavButtonsState(); - $( '.next-theme' ).focus(); + $( '.next-theme' ).trigger( 'focus' ); }) .listenTo( preview, 'theme:previous', function() { @@ -580,7 +576,7 @@ // Render and append. preview.render(); this.setNavButtonsState(); - $( '.previous-theme' ).focus(); + $( '.previous-theme' ).trigger( 'focus' ); }); this.listenTo( preview, 'preview:close', function() { @@ -602,7 +598,7 @@ .addClass( 'disabled' ) .prop( 'disabled', true ); - nextThemeButton.focus(); + nextThemeButton.trigger( 'focus' ); } // Disable next if the next model is undefined. @@ -611,7 +607,7 @@ .addClass( 'disabled' ) .prop( 'disabled', true ); - previousThemeButton.focus(); + previousThemeButton.trigger( 'focus' ); } }, @@ -705,7 +701,7 @@ // Set initial focus on the primary action control. _.delay( function() { - $( '.theme-overlay' ).focus(); + $( '.theme-overlay' ).trigger( 'focus' ); }, 100 ); // Constrain tabbing within the modal. @@ -716,10 +712,10 @@ // Check for the Tab key. if ( 9 === event.which ) { if ( $firstFocusable[0] === event.target && event.shiftKey ) { - $lastFocusable.focus(); + $lastFocusable.trigger( 'focus' ); event.preventDefault(); } else if ( $lastFocusable[0] === event.target && ! event.shiftKey ) { - $firstFocusable.focus(); + $firstFocusable.trigger( 'focus' ); event.preventDefault(); } } @@ -764,7 +760,7 @@ // Return focus to the theme div. if ( themes.focusedTheme ) { - themes.focusedTheme.focus(); + themes.focusedTheme.find('.more-details').trigger( 'focus' ); } }); } @@ -952,7 +948,7 @@ // Return focus to the theme div. if ( themes.focusedTheme ) { - themes.focusedTheme.focus(); + themes.focusedTheme.find('.more-details').trigger( 'focus' ); } }).removeClass( 'iframe-ready' ); @@ -1965,7 +1961,7 @@ // Set up the view. // Passes the default 'section' as an option. this.view = new themes.view.Installer({ - section: 'featured', + section: 'popular', SearchView: themes.view.InstallerSearch }); @@ -2032,12 +2028,12 @@ /* * Handles sorting / browsing routes. * Also handles the root URL triggering a sort request - * for `featured`, the default view. + * for `popular`, the default view. */ themes.router.on( 'route:sort', function( sort ) { if ( ! sort ) { - sort = 'featured'; - themes.router.navigate( themes.router.baseUrl( '?browse=featured' ), { replace: true } ); + sort = 'popular'; + themes.router.navigate( themes.router.baseUrl( '?browse=popular' ), { replace: true } ); } self.view.sort( sort ); @@ -2049,7 +2045,7 @@ // The `search` route event. The router populates the input field. themes.router.on( 'route:search', function() { - $( '.wp-filter-search' ).focus().trigger( 'keyup' ); + $( '.wp-filter-search' ).trigger( 'focus' ).trigger( 'keyup' ); }); this.extraRoutes(); @@ -2061,7 +2057,7 @@ }; // Ready... -$( document ).ready(function() { +$( function() { if ( themes.isInstall ) { themes.RunInstaller.init(); } else { @@ -2089,7 +2085,7 @@ })( jQuery ); // Align theme browser thickbox. -jQuery(document).ready( function($) { +jQuery( function($) { window.tb_position = function() { var tbWindow = $('#TB_window'), width = $(window).width(), @@ -2101,7 +2097,7 @@ adminbar_height = parseInt( $('#wpadminbar').css('height'), 10 ); } - if ( tbWindow.size() ) { + if ( tbWindow.length >= 1 ) { tbWindow.width( W - 50 ).height( H - 45 - adminbar_height ); $('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height ); tbWindow.css({'margin-left': '-' + parseInt( ( ( W - 50 ) / 2 ), 10 ) + 'px'}); @@ -2111,5 +2107,5 @@ } }; - $(window).resize(function(){ tb_position(); }); + $(window).on( 'resize', function(){ tb_position(); }); });