From 2a86d8d534491eb1033d2988ca855f4249ead9de Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Wed, 20 May 2020 13:33:07 +0000 Subject: [PATCH] Accessibility: Media: Hide the invisible "file input" on media views from assistive technologies. The file input button is visually hidden, but was announced by screen readers in workflows unrelated to file uploads. It is now hidden from assistive technologies by the means of an `aria-hidden` attribute, as its CSS display property must not be changed to make sure it still works on old browsers. See #49753. Fixes #47611. Built from https://develop.svn.wordpress.org/trunk@47834 git-svn-id: http://core.svn.wordpress.org/trunk@47610 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/plupload/wp-plupload.js | 19 ++++++++++++------- wp-includes/js/plupload/wp-plupload.min.js | 2 +- wp-includes/version.php | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/wp-includes/js/plupload/wp-plupload.js b/wp-includes/js/plupload/wp-plupload.js index e42288fbe4..6839fd81d7 100644 --- a/wp-includes/js/plupload/wp-plupload.js +++ b/wp-includes/js/plupload/wp-plupload.js @@ -120,8 +120,7 @@ window.wp = window.wp || {}; * @param {plupload.File} file File that was uploaded. */ tryAgain = function( message, data, file ) { - var times; - var id; + var times, id; if ( ! data || ! data.responseHeaders ) { error( pluploadL10n.http_error_image, data, file, 'no-retry' ); @@ -210,8 +209,8 @@ window.wp = window.wp || {}; * @param {string} retry Whether to try again to create image sub-sizes. Passing 'no-retry' will prevent it. */ error = function( message, data, file, retry ) { - var isImage = file.type && file.type.indexOf( 'image/' ) === 0; - var status = data && data.status; + var isImage = file.type && file.type.indexOf( 'image/' ) === 0, + status = data && data.status; // If the file is an image and the error is HTTP 5xx try to create sub-sizes again. if ( retry !== 'no-retry' && isImage && status >= 500 && status < 600 ) { @@ -327,10 +326,16 @@ window.wp = window.wp || {}; this.browser.on( 'mouseenter', this.refresh ); } else { this.uploader.disableBrowse( true ); - // If HTML5 mode, hide the auto-created file container. - $('#' + this.uploader.id + '_html5_container').hide(); } + $( self ).on( 'uploader:ready', function() { + $( '.moxie-shim-html5 input[type="file"]' ) + .attr( { + tabIndex: '-1', + 'aria-hidden': 'true' + } ); + } ); + /** * After files were filtered and added to the queue, create a model for each. * @@ -521,7 +526,7 @@ window.wp = window.wp || {}; /* * If the browser node is not attached to the DOM, - * use a temporary container to house it, as the browser button shims + * use a temporary container to house it, as the browser button shims * require the button to exist in the DOM at all times. */ if ( ! attached ) { diff --git a/wp-includes/js/plupload/wp-plupload.min.js b/wp-includes/js/plupload/wp-plupload.min.js index bd612b1415..f95d5eeabe 100644 --- a/wp-includes/js/plupload/wp-plupload.min.js +++ b/wp-includes/js/plupload/wp-plupload.min.js @@ -1 +1 @@ -window.wp=window.wp||{},function(e,l){var u;"undefined"!=typeof _wpPluploadSettings&&(u=function(e){var n,t,i,d,p=this,r={container:"container",browser:"browse_button",dropzone:"drop_element"},s={};if(this.supports={upload:u.browser.supported},this.supported=this.supports.upload,this.supported){for(t in this.plupload=l.extend(!0,{multipart_params:{}},u.defaults),this.container=document.body,l.extend(!0,this,e),this)l.isFunction(this[t])&&(this[t]=l.proxy(this[t],this));for(t in r)this[t]&&(this[t]=l(this[t]).first(),this[t].length?(this[t].prop("id")||this[t].prop("id","__wp-uploader-id-"+u.uuid++),this.plupload[r[t]]=this[t].prop("id")):delete this[t]);(this.browser&&this.browser.length||this.dropzone&&this.dropzone.length)&&(this.uploader=new plupload.Uploader(this.plupload),delete this.plupload,this.param(this.params||{}),delete this.params,n=function(t,r,a){var e,o;if(r&&r.responseHeaders)if((o=r.responseHeaders.match(/x-wp-upload-attachment-id:\s*(\d+)/i))&&o[1]){if(o=o[1],(e=s[a.id])&&4').css({position:"fixed",top:"-1000px",left:"-1000px",height:0,width:0}).attr("id","wp-uploader-browser-"+this.uploader.id).appendTo("body")),r.append(this.browser))}this.uploader.refresh()}}),u.queue=new wp.media.model.Attachments([],{query:!1}),u.errors=new Backbone.Collection,e.Uploader=u)}(wp,jQuery); \ No newline at end of file +window.wp=window.wp||{},function(e,u){var l;"undefined"!=typeof _wpPluploadSettings&&(l=function(e){var n,t,i,d,p=this,a={container:"container",browser:"browse_button",dropzone:"drop_element"},s={};if(this.supports={upload:l.browser.supported},this.supported=this.supports.upload,this.supported){for(t in this.plupload=u.extend(!0,{multipart_params:{}},l.defaults),this.container=document.body,u.extend(!0,this,e),this)u.isFunction(this[t])&&(this[t]=u.proxy(this[t],this));for(t in a)this[t]&&(this[t]=u(this[t]).first(),this[t].length?(this[t].prop("id")||this[t].prop("id","__wp-uploader-id-"+l.uuid++),this.plupload[a[t]]=this[t].prop("id")):delete this[t]);(this.browser&&this.browser.length||this.dropzone&&this.dropzone.length)&&(this.uploader=new plupload.Uploader(this.plupload),delete this.plupload,this.param(this.params||{}),delete this.params,n=function(t,a,r){var e,o;if(a&&a.responseHeaders)if((o=a.responseHeaders.match(/x-wp-upload-attachment-id:\s*(\d+)/i))&&o[1]){if(o=o[1],(e=s[r.id])&&4').css({position:"fixed",top:"-1000px",left:"-1000px",height:0,width:0}).attr("id","wp-uploader-browser-"+this.uploader.id).appendTo("body")),a.append(this.browser))}this.uploader.refresh()}}),l.queue=new wp.media.model.Attachments([],{query:!1}),l.errors=new Backbone.Collection,e.Uploader=l)}(wp,jQuery); \ No newline at end of file diff --git a/wp-includes/version.php b/wp-includes/version.php index 6af3c36e77..e67290ef2f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-47832'; +$wp_version = '5.5-alpha-47834'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.