mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-06 15:47:05 +00:00
Accessibility: Theme Installer, make the "Upload Theme" button... a button.
UI controls that "do something" on a page shouldn't be links. This link behaves like a toggle to expand the uploader panel and should be a `button` element with an aria-expanded attribute. Also: - improves consistency with the Plugin uploader - keeps the themes list visible when the uploader is open - displays a notice when JavaScript is off - adds some `hide-if-no-js` CSS classes - removes the `themes.router.navigate()` "upload" route: seems unnecessary and breaks history Fixes #35457. git-svn-id: https://develop.svn.wordpress.org/trunk@37742 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1745,23 +1745,18 @@ themes.view.Installer = themes.view.Appearance.extend({
|
||||
searchContainer: $( '.wp-filter .search-form' ),
|
||||
|
||||
/*
|
||||
* When a user presses the "Upload Theme" button, show the upload form in place.
|
||||
* @todo consider to abstract this in a generic, reusable, utility, see plugin-install.js
|
||||
* When users press the "Upload Theme" button, show the upload form in place.
|
||||
*/
|
||||
uploader: function() {
|
||||
var uploadViewToggle = $( '.upload-view-toggle' ),
|
||||
$body = $( document.body );
|
||||
|
||||
uploadViewToggle
|
||||
.attr({
|
||||
role: 'button',
|
||||
'aria-expanded': 'false'
|
||||
})
|
||||
.on( 'click', function( event ) {
|
||||
event.preventDefault();
|
||||
$body.toggleClass( 'show-upload-view' );
|
||||
uploadViewToggle.attr( 'aria-expanded', $body.hasClass( 'show-upload-view' ) );
|
||||
});
|
||||
uploadViewToggle.on( 'click', function() {
|
||||
// Toggle the upload view.
|
||||
$body.toggleClass( 'show-upload-view' );
|
||||
// Toggle the `aria-expanded` button attribute.
|
||||
uploadViewToggle.attr( 'aria-expanded', $body.hasClass( 'show-upload-view' ) );
|
||||
});
|
||||
},
|
||||
|
||||
// Toggle the full filters navigation
|
||||
@@ -1815,7 +1810,6 @@ themes.InstallerRouter = Backbone.Router.extend({
|
||||
routes: {
|
||||
'theme-install.php?theme=:slug': 'preview',
|
||||
'theme-install.php?browse=:sort': 'sort',
|
||||
'theme-install.php?upload': 'upload',
|
||||
'theme-install.php?search=:query': 'search',
|
||||
'theme-install.php': 'sort'
|
||||
},
|
||||
@@ -1897,11 +1891,6 @@ themes.RunInstaller = {
|
||||
self.view.trigger( 'theme:close' );
|
||||
});
|
||||
|
||||
// Support the `upload` route by going straight to upload section
|
||||
themes.router.on( 'route:upload', function() {
|
||||
$( 'a.upload' ).trigger( 'click' );
|
||||
});
|
||||
|
||||
// The `search` route event. The router populates the input field.
|
||||
themes.router.on( 'route:search', function() {
|
||||
$( '.wp-filter-search' ).focus().trigger( 'keyup' );
|
||||
|
||||
Reference in New Issue
Block a user