diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index 7ea9ed3cb6..29b56c66a8 100644 --- a/src/wp-includes/js/media-views.js +++ b/src/wp-includes/js/media-views.js @@ -8228,13 +8228,13 @@ UploaderInline = View.extend({ }, show: function() { this.$el.removeClass( 'hidden' ); - if ( this.controller.$uploaderToggler.length ) { + if ( this.controller.$uploaderToggler && this.controller.$uploaderToggler.length ) { this.controller.$uploaderToggler.attr( 'aria-expanded', 'true' ); } }, hide: function() { this.$el.addClass( 'hidden' ); - if ( this.controller.$uploaderToggler.length ) { + if ( this.controller.$uploaderToggler && this.controller.$uploaderToggler.length ) { this.controller.$uploaderToggler .attr( 'aria-expanded', 'false' ) // Move focus back to the toggle button when closing the uploader. diff --git a/src/wp-includes/js/media/views/uploader/inline.js b/src/wp-includes/js/media/views/uploader/inline.js index f6be006b6b..dfb208f851 100644 --- a/src/wp-includes/js/media/views/uploader/inline.js +++ b/src/wp-includes/js/media/views/uploader/inline.js @@ -119,13 +119,13 @@ UploaderInline = View.extend({ }, show: function() { this.$el.removeClass( 'hidden' ); - if ( this.controller.$uploaderToggler.length ) { + if ( this.controller.$uploaderToggler && this.controller.$uploaderToggler.length ) { this.controller.$uploaderToggler.attr( 'aria-expanded', 'true' ); } }, hide: function() { this.$el.addClass( 'hidden' ); - if ( this.controller.$uploaderToggler.length ) { + if ( this.controller.$uploaderToggler && this.controller.$uploaderToggler.length ) { this.controller.$uploaderToggler .attr( 'aria-expanded', 'false' ) // Move focus back to the toggle button when closing the uploader.