updateTheme: function( event ) {
var _this = this;
+
+ if ( ! this.model.get( 'hasPackage' ) ) {
+ return;
+ }
+
event.preventDefault();
wp.updates.maybeRequestFilesystemCredentials( event );
html: themes.template( 'theme-preview' ),
render: function() {
- var self = this, currentPreviewDevice,
- data = this.model.toJSON();
+ var self = this,
+ currentPreviewDevice,
+ data = this.model.toJSON(),
+ $body = $( document.body );
+
+ $body.attr( 'aria-busy', 'true' );
this.$el.removeClass( 'iframe-ready' ).html( this.html( data ) );
themes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.get( 'id' ) ), { replace: true } );
this.$el.fadeIn( 200, function() {
- $( 'body' ).addClass( 'theme-installer-active full-overlay-active' );
- $( '.close-full-overlay' ).focus();
+ $body.addClass( 'theme-installer-active full-overlay-active' );
});
this.$el.find( 'iframe' ).one( 'load', function() {
iframeLoaded: function() {
this.$el.addClass( 'iframe-ready' );
+ $( document.body ).attr( 'aria-busy', 'false' );
},
close: function() {
$( '.filter-links li > a.current' ).removeClass( 'current' );
$( 'body' ).removeClass( 'show-filters filters-applied show-favorites-form' );
+ $( '.drawer-toggle' ).attr( 'aria-expanded', 'false' );
// Get the themes by sending Ajax POST request to api.wordpress.org/themes
// or searching the local cache
'click .filter-drawer .apply-filters': 'applyFilters',
'click .filter-group [type="checkbox"]': 'addFilter',
'click .filter-drawer .clear-filters': 'clearFilters',
- 'click .filtered-by': 'backToFilters',
+ 'click .edit-filters': 'backToFilters',
'click .favorites-form-submit' : 'saveUsername',
'keyup #wporg-username-input': 'saveUsername'
},
event.preventDefault();
$( 'body' ).removeClass( 'filters-applied show-filters' );
+ $( '.drawer-toggle' ).attr( 'aria-expanded', 'false' );
// Bail if this is already active
if ( $el.hasClass( this.activeClass ) ) {
$( '[data-sort="' + sort + '"]' ).addClass( this.activeClass );
if ( 'favorites' === sort ) {
- $ ( 'body' ).addClass( 'show-favorites-form' );
+ $( 'body' ).addClass( 'show-favorites-form' );
} else {
- $ ( 'body' ).removeClass( 'show-favorites-form' );
+ $( 'body' ).removeClass( 'show-favorites-form' );
}
this.browse( sort );
event.preventDefault();
}
+ if ( ! tags ) {
+ wp.a11y.speak( l10n.selectFeatureFilter );
+ return;
+ }
+
$( 'body' ).addClass( 'filters-applied' );
$( '.filter-links li > a.current' ).removeClass( 'current' );
filteringBy.empty();
// Toggle the full filters navigation
moreFilters: function( event ) {
+ var $body = $( 'body' ),
+ $toggleButton = $( '.drawer-toggle' );
+
event.preventDefault();
- if ( $( 'body' ).hasClass( 'filters-applied' ) ) {
+ if ( $body.hasClass( 'filters-applied' ) ) {
return this.backToFilters();
}
- // If the filters section is opened and filters are checked
- // run the relevant query collapsing to filtered-by state
- if ( $( 'body' ).hasClass( 'show-filters' ) && this.filtersChecked() ) {
- return this.addFilter();
- }
-
this.clearSearch();
themes.router.navigate( themes.router.baseUrl( '' ) );
- $( 'body' ).toggleClass( 'show-filters' );
+ // Toggle the feature filters view.
+ $body.toggleClass( 'show-filters' );
+ // Toggle the `aria-expanded` button attribute.
+ $toggleButton.attr( 'aria-expanded', $body.hasClass( 'show-filters' ) );
},
// Clears all the checked filters