Accessibility: Privacy: Accessibility improvements for the Privacy Policy Guide page.
Improves accessibility of the "Copy this section" button and "Return to Top" link: - uses `setTimeout()` and `clearTimeout()` to properly handle the "Copied!" text - simplifies the button text by removing the redundant visually hidden text - fixes the mismatching visual and DOM order of the Copy button and the "Return to Top" link - improves the "Return to Top" links by providing real page fragment identifiers, when possible - hides the "Return to Top" up arrow from assistive technologies - minor coding standards Props afercia, garrett-eclipse. See #48463, #50322. Fixes #50335. Built from https://develop.svn.wordpress.org/trunk@48234 git-svn-id: http://core.svn.wordpress.org/trunk@48003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7a785704c0
commit
c4f6669d69
|
@ -718,6 +718,8 @@ form#tags-filter {
|
|||
}
|
||||
|
||||
.privacy-text-actions {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
height: 32px;
|
||||
line-height: 2.46153846;
|
||||
padding-bottom: 6px;
|
||||
|
@ -744,12 +746,19 @@ form#tags-filter {
|
|||
font-style: italic;
|
||||
}
|
||||
|
||||
.privacy-text-section a.return-to-top {
|
||||
.privacy-text-section .return-to-top {
|
||||
float: left;
|
||||
margin-left: -250px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
#wpbody:target:before {
|
||||
content: "";
|
||||
display: block;
|
||||
padding-top: 50px;
|
||||
margin-top: -50px;
|
||||
}
|
||||
|
||||
.hide-privacy-policy-tutorial {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
@ -1759,8 +1768,7 @@ table.links-table {
|
|||
flex-direction: column;
|
||||
}
|
||||
|
||||
.privacy-text-section a.return-to-top {
|
||||
float: none;
|
||||
margin: 0;
|
||||
.privacy-text-section .return-to-top {
|
||||
margin: 2em 0 0;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -717,6 +717,8 @@ form#tags-filter {
|
|||
}
|
||||
|
||||
.privacy-text-actions {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
height: 32px;
|
||||
line-height: 2.46153846;
|
||||
padding-bottom: 6px;
|
||||
|
@ -743,12 +745,19 @@ form#tags-filter {
|
|||
font-style: italic;
|
||||
}
|
||||
|
||||
.privacy-text-section a.return-to-top {
|
||||
.privacy-text-section .return-to-top {
|
||||
float: right;
|
||||
margin-right: -250px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
#wpbody:target:before {
|
||||
content: "";
|
||||
display: block;
|
||||
padding-top: 50px;
|
||||
margin-top: -50px;
|
||||
}
|
||||
|
||||
.hide-privacy-policy-tutorial {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
@ -1758,8 +1767,7 @@ table.links-table {
|
|||
flex-direction: column;
|
||||
}
|
||||
|
||||
.privacy-text-section a.return-to-top {
|
||||
float: none;
|
||||
margin: 0;
|
||||
.privacy-text-section .return-to-top {
|
||||
margin: 2em 0 0;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -412,21 +412,18 @@ final class WP_Privacy_Policy_Content {
|
|||
$content .= $removed;
|
||||
|
||||
$content .= '<div class="policy-text">' . $section['policy_text'] . '</div>';
|
||||
$content .= '<a href="#" class="return-to-top">' . __( '↑ Return to Top' ) . '</a>';
|
||||
|
||||
if ( empty( $section['removed'] ) ) {
|
||||
$content .= '<div class="privacy-text-actions">';
|
||||
$content .= '<button type="button" class="privacy-text-copy button">';
|
||||
$content .= __( 'Copy this section to clipboard' );
|
||||
$content .= '<span class="screen-reader-text">';
|
||||
/* translators: %s: Plugin name. */
|
||||
$content .= sprintf( __( 'Copy suggested policy text from %s.' ), $plugin_name );
|
||||
$content .= '</span>';
|
||||
$content .= '</button>';
|
||||
$content .= '<span class="success" aria-hidden="true">' . __( 'Copied!' ) . '</span>';
|
||||
$content .= '</div>';
|
||||
}
|
||||
|
||||
$content .= '<a href="#wpbody" class="return-to-top"><span aria-hidden="true">↑ </span> ' . __( 'Return to Top' ) . '</a>';
|
||||
|
||||
$content .= '</div>'; // End of .privacy-text-section.
|
||||
}
|
||||
|
||||
|
|
|
@ -278,8 +278,8 @@ function wp_privacy_generate_personal_data_export_group_html( $group_data, $grou
|
|||
}
|
||||
|
||||
if ( 1 < $groups_count ) {
|
||||
$group_html .= '<div class="return_to_top">';
|
||||
$group_html .= '<a href="#top">' . esc_html__( '↑ Return to top' ) . '</a>';
|
||||
$group_html .= '<div class="return-to-top">';
|
||||
$group_html .= '<a href="#top"><span aria-hidden="true">↑ </span> ' . esc_html__( 'Return to top' ) . '</a>';
|
||||
$group_html .= '</div>';
|
||||
}
|
||||
|
||||
|
@ -423,7 +423,7 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) {
|
|||
fwrite( $file, 'th { padding: 5px; text-align: left; width: 20%; }' );
|
||||
fwrite( $file, 'td { padding: 5px; }' );
|
||||
fwrite( $file, 'tr:nth-child(odd) { background-color: #fafafa; }' );
|
||||
fwrite( $file, '.return_to_top { text-align:right; }' );
|
||||
fwrite( $file, '.return-to-top { text-align: right; }' );
|
||||
fwrite( $file, '</style>' );
|
||||
fwrite( $file, '<title>' );
|
||||
fwrite( $file, esc_html( $title ) );
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
|
||||
// Privacy request action handling.
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
var strings = window.privacyToolsL10n || {};
|
||||
var strings = window.privacyToolsL10n || {},
|
||||
copiedNoticeTimeout;
|
||||
|
||||
function setActionState( $action, state ) {
|
||||
$action.children().addClass( 'hidden' );
|
||||
|
@ -88,7 +89,7 @@ jQuery( document ).ready( function( $ ) {
|
|||
onExportFailure( strings.noExportFile );
|
||||
}
|
||||
|
||||
setTimeout( function(){ $rowActions.removeClass( 'processing' ); }, 500 );
|
||||
setTimeout( function() { $rowActions.removeClass( 'processing' ); }, 500 );
|
||||
}
|
||||
|
||||
function onExportFailure( errorMessage ) {
|
||||
|
@ -97,12 +98,13 @@ jQuery( document ).ready( function( $ ) {
|
|||
appendResultsAfterRow( $requestRow, 'notice-error', strings.exportError, [ errorMessage ] );
|
||||
}
|
||||
|
||||
setTimeout( function(){ $rowActions.removeClass( 'processing' ); }, 500 );
|
||||
setTimeout( function() { $rowActions.removeClass( 'processing' ); }, 500 );
|
||||
}
|
||||
|
||||
function setExportProgress( exporterIndex ) {
|
||||
var progress = ( exportersCount > 0 ? exporterIndex / exportersCount : 0 );
|
||||
var progressString = Math.round( progress * 100 ).toString() + '%';
|
||||
var progress = ( exportersCount > 0 ? exporterIndex / exportersCount : 0 ),
|
||||
progressString = Math.round( progress * 100 ).toString() + '%';
|
||||
|
||||
$progress.html( progressString );
|
||||
}
|
||||
|
||||
|
@ -125,7 +127,7 @@ jQuery( document ).ready( function( $ ) {
|
|||
|
||||
if ( ! response.success ) {
|
||||
// e.g. invalid request ID.
|
||||
setTimeout( function(){ onExportFailure( response.data ); }, 500 );
|
||||
setTimeout( function() { onExportFailure( response.data ); }, 500 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -136,12 +138,12 @@ jQuery( document ).ready( function( $ ) {
|
|||
if ( exporterIndex < exportersCount ) {
|
||||
setTimeout( doNextExport( exporterIndex + 1, 1 ) );
|
||||
} else {
|
||||
setTimeout( function(){ onExportDoneSuccess( responseData.url ); }, 500 );
|
||||
setTimeout( function() { onExportDoneSuccess( responseData.url ); }, 500 );
|
||||
}
|
||||
}
|
||||
}).fail( function( jqxhr, textStatus, error ) {
|
||||
// e.g. Nonce failure.
|
||||
setTimeout( function(){ onExportFailure( error ); }, 500 );
|
||||
setTimeout( function() { onExportFailure( error ); }, 500 );
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -173,8 +175,8 @@ jQuery( document ).ready( function( $ ) {
|
|||
setErasureProgress( 0 );
|
||||
|
||||
function onErasureDoneSuccess() {
|
||||
var summaryMessage = strings.noDataFound;
|
||||
var classes = 'notice-success';
|
||||
var summaryMessage = strings.noDataFound,
|
||||
classes = 'notice-success';
|
||||
|
||||
setActionState( $action, 'remove-personal-data-success' );
|
||||
|
||||
|
@ -195,19 +197,20 @@ jQuery( document ).ready( function( $ ) {
|
|||
}
|
||||
appendResultsAfterRow( $requestRow, classes, summaryMessage, messages );
|
||||
|
||||
setTimeout( function(){ $rowActions.removeClass( 'processing' ); }, 500 );
|
||||
setTimeout( function() { $rowActions.removeClass( 'processing' ); }, 500 );
|
||||
}
|
||||
|
||||
function onErasureFailure() {
|
||||
setActionState( $action, 'remove-personal-data-failed' );
|
||||
appendResultsAfterRow( $requestRow, 'notice-error', strings.removalError, [] );
|
||||
|
||||
setTimeout( function(){ $rowActions.removeClass( 'processing' ); }, 500 );
|
||||
setTimeout( function() { $rowActions.removeClass( 'processing' ); }, 500 );
|
||||
}
|
||||
|
||||
function setErasureProgress( eraserIndex ) {
|
||||
var progress = ( erasersCount > 0 ? eraserIndex / erasersCount : 0 );
|
||||
var progressString = Math.round( progress * 100 ).toString() + '%';
|
||||
var progress = ( erasersCount > 0 ? eraserIndex / erasersCount : 0 ),
|
||||
progressString = Math.round( progress * 100 ).toString() + '%';
|
||||
|
||||
$progress.html( progressString );
|
||||
}
|
||||
|
||||
|
@ -226,7 +229,7 @@ jQuery( document ).ready( function( $ ) {
|
|||
var responseData = response.data;
|
||||
|
||||
if ( ! response.success ) {
|
||||
setTimeout( function(){ onErasureFailure(); }, 500 );
|
||||
setTimeout( function() { onErasureFailure(); }, 500 );
|
||||
return;
|
||||
}
|
||||
if ( responseData.items_removed ) {
|
||||
|
@ -245,11 +248,11 @@ jQuery( document ).ready( function( $ ) {
|
|||
if ( eraserIndex < erasersCount ) {
|
||||
setTimeout( doNextErasure( eraserIndex + 1, 1 ) );
|
||||
} else {
|
||||
setTimeout( function(){ onErasureDoneSuccess(); }, 500 );
|
||||
setTimeout( function() { onErasureDoneSuccess(); }, 500 );
|
||||
}
|
||||
}
|
||||
}).fail( function() {
|
||||
setTimeout( function(){ onErasureFailure(); }, 500 );
|
||||
setTimeout( function() { onErasureFailure(); }, 500 );
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -268,6 +271,8 @@ jQuery( document ).ready( function( $ ) {
|
|||
$target = $( event.target ),
|
||||
copiedNotice = $target.siblings( '.success' );
|
||||
|
||||
clearTimeout( copiedNoticeTimeout );
|
||||
|
||||
if ( $target.is( 'button.privacy-text-copy' ) ) {
|
||||
$parent = $target.parent().parent();
|
||||
$container = $parent.find( 'div.wp-suggested-text' );
|
||||
|
@ -309,10 +314,11 @@ jQuery( document ).ready( function( $ ) {
|
|||
wp.a11y.speak( __( 'The section has been copied to your clipboard.' ) );
|
||||
|
||||
// Delay notice dismissal.
|
||||
setTimeout( function(){ copiedNotice.removeClass( 'visible' ); }, 3000 );
|
||||
copiedNoticeTimeout = setTimeout( function() {
|
||||
copiedNotice.removeClass( 'visible' );
|
||||
}, 3000 );
|
||||
} catch ( er ) {}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
/*! This file is auto-generated */
|
||||
jQuery(document).ready(function(g){var h=window.privacyToolsL10n||{};function w(e,t){e.children().addClass("hidden"),e.children("."+t).removeClass("hidden")}function T(e){e.removeClass("has-request-results"),e.next().hasClass("request-results")&&e.next().remove()}function x(e,t,o,n){var s="",a="request-results";T(e),n.length&&(g.each(n,function(e,t){s=s+"<li>"+t+"</li>"}),s="<ul>"+s+"</ul>"),e.addClass("has-request-results"),e.hasClass("status-request-confirmed")&&(a+=" status-request-confirmed"),e.hasClass("status-request-failed")&&(a+=" status-request-failed"),e.after(function(){return'<tr class="'+a+'"><th colspan="5"><div class="notice inline notice-alt '+t+'"><p>'+o+"</p>"+s+"</div></td></tr>"})}g(".export-personal-data-handle").click(function(e){var t=g(this),a=t.parents(".export-personal-data"),r=t.parents("tr"),n=r.find(".export-progress"),i=t.parents(".row-actions"),c=a.data("request-id"),d=a.data("nonce"),u=a.data("exporters-count"),l=!!a.data("send-as-email");function p(e){w(a,"export-personal-data-failed"),e&&x(r,"notice-error",h.exportError,[e]),setTimeout(function(){i.removeClass("processing")},500)}function m(e){var t=0<u?e/u:0,o=Math.round(100*t).toString()+"%";n.html(o)}e.preventDefault(),e.stopPropagation(),i.addClass("processing"),a.blur(),T(r),m(0),w(a,"export-personal-data-processing"),function o(n,s){g.ajax({url:window.ajaxurl,data:{action:"wp-privacy-export-personal-data",exporter:n,id:c,page:s,security:d,sendAsEmail:l},method:"post"}).done(function(e){var t=e.data;e.success?t.done?(m(n),n<u?setTimeout(o(n+1,1)):setTimeout(function(){!function(e){var t=h.emailSent;w(a,"export-personal-data-success"),x(r,"notice-success",t,[]),void 0!==e?window.location=e:l||p(h.noExportFile),setTimeout(function(){i.removeClass("processing")},500)}(t.url)},500)):setTimeout(o(n,s+1)):setTimeout(function(){p(e.data)},500)}).fail(function(e,t,o){setTimeout(function(){p(o)},500)})}(1,1)}),g(".remove-personal-data-handle").click(function(e){var t=g(this),a=t.parents(".remove-personal-data"),r=t.parents("tr"),n=r.find(".erasure-progress"),i=t.parents(".row-actions"),c=a.data("request-id"),d=a.data("nonce"),u=a.data("erasers-count"),l=!1,p=!1,m=[];function f(){w(a,"remove-personal-data-failed"),x(r,"notice-error",h.removalError,[]),setTimeout(function(){i.removeClass("processing")},500)}function v(e){var t=0<u?e/u:0,o=Math.round(100*t).toString()+"%";n.html(o)}e.preventDefault(),e.stopPropagation(),i.addClass("processing"),a.blur(),T(r),v(0),w(a,"remove-personal-data-processing"),function o(n,s){g.ajax({url:window.ajaxurl,data:{action:"wp-privacy-erase-personal-data",eraser:n,id:c,page:s,security:d},method:"post"}).done(function(e){var t=e.data;e.success?(t.items_removed&&(l=l||t.items_removed),t.items_retained&&(p=p||t.items_retained),t.messages&&(m=m.concat(t.messages)),t.done?(v(n),n<u?setTimeout(o(n+1,1)):setTimeout(function(){!function(){var e=h.noDataFound,t="notice-success";w(a,"remove-personal-data-success"),!1===l?!1===p?e=h.noDataFound:(e=h.noneRemoved,t="notice-warning"):!1===p?e=h.foundAndRemoved:(e=h.someNotRemoved,t="notice-warning"),x(r,t,e,m),setTimeout(function(){i.removeClass("processing")},500)}()},500)):setTimeout(o(n,s+1))):setTimeout(function(){f()},500)}).fail(function(){setTimeout(function(){f()},500)})}(1,1)}),g(document).on("click",function(e){var t,o,n,s=wp.i18n.__,a=g(e.target),r=a.siblings(".success");if(a.is("button.privacy-text-copy")&&((o=(t=a.parent().parent()).find("div.wp-suggested-text")).length||(o=t.find("div.policy-text")),o.length))try{var i=document.documentElement.scrollTop,c=document.body.scrollTop;window.getSelection().removeAllRanges(),n=document.createRange(),o.addClass("hide-privacy-policy-tutorial"),n.selectNodeContents(o[0]),window.getSelection().addRange(n),document.execCommand("copy"),o.removeClass("hide-privacy-policy-tutorial"),window.getSelection().removeAllRanges(),0<i&&i!==document.documentElement.scrollTop?document.documentElement.scrollTop=i:0<c&&c!==document.body.scrollTop&&(document.body.scrollTop=c),r.addClass("visible"),wp.a11y.speak(s("The section has been copied to your clipboard.")),setTimeout(function(){r.removeClass("visible")},3e3)}catch(e){}})});
|
||||
jQuery(document).ready(function(g){var d,h=window.privacyToolsL10n||{};function T(e,t){e.children().addClass("hidden"),e.children("."+t).removeClass("hidden")}function w(e){e.removeClass("has-request-results"),e.next().hasClass("request-results")&&e.next().remove()}function x(e,t,o,n){var s="",a="request-results";w(e),n.length&&(g.each(n,function(e,t){s=s+"<li>"+t+"</li>"}),s="<ul>"+s+"</ul>"),e.addClass("has-request-results"),e.hasClass("status-request-confirmed")&&(a+=" status-request-confirmed"),e.hasClass("status-request-failed")&&(a+=" status-request-failed"),e.after(function(){return'<tr class="'+a+'"><th colspan="5"><div class="notice inline notice-alt '+t+'"><p>'+o+"</p>"+s+"</div></td></tr>"})}g(".export-personal-data-handle").click(function(e){var t=g(this),a=t.parents(".export-personal-data"),r=t.parents("tr"),n=r.find(".export-progress"),i=t.parents(".row-actions"),c=a.data("request-id"),d=a.data("nonce"),u=a.data("exporters-count"),l=!!a.data("send-as-email");function p(e){T(a,"export-personal-data-failed"),e&&x(r,"notice-error",h.exportError,[e]),setTimeout(function(){i.removeClass("processing")},500)}function m(e){var t=0<u?e/u:0,o=Math.round(100*t).toString()+"%";n.html(o)}e.preventDefault(),e.stopPropagation(),i.addClass("processing"),a.blur(),w(r),m(0),T(a,"export-personal-data-processing"),function o(n,s){g.ajax({url:window.ajaxurl,data:{action:"wp-privacy-export-personal-data",exporter:n,id:c,page:s,security:d,sendAsEmail:l},method:"post"}).done(function(e){var t=e.data;e.success?t.done?(m(n),n<u?setTimeout(o(n+1,1)):setTimeout(function(){!function(e){var t=h.emailSent;T(a,"export-personal-data-success"),x(r,"notice-success",t,[]),void 0!==e?window.location=e:l||p(h.noExportFile),setTimeout(function(){i.removeClass("processing")},500)}(t.url)},500)):setTimeout(o(n,s+1)):setTimeout(function(){p(e.data)},500)}).fail(function(e,t,o){setTimeout(function(){p(o)},500)})}(1,1)}),g(".remove-personal-data-handle").click(function(e){var t=g(this),a=t.parents(".remove-personal-data"),r=t.parents("tr"),n=r.find(".erasure-progress"),i=t.parents(".row-actions"),c=a.data("request-id"),d=a.data("nonce"),u=a.data("erasers-count"),l=!1,p=!1,m=[];function f(){T(a,"remove-personal-data-failed"),x(r,"notice-error",h.removalError,[]),setTimeout(function(){i.removeClass("processing")},500)}function v(e){var t=0<u?e/u:0,o=Math.round(100*t).toString()+"%";n.html(o)}e.preventDefault(),e.stopPropagation(),i.addClass("processing"),a.blur(),w(r),v(0),T(a,"remove-personal-data-processing"),function o(n,s){g.ajax({url:window.ajaxurl,data:{action:"wp-privacy-erase-personal-data",eraser:n,id:c,page:s,security:d},method:"post"}).done(function(e){var t=e.data;e.success?(t.items_removed&&(l=l||t.items_removed),t.items_retained&&(p=p||t.items_retained),t.messages&&(m=m.concat(t.messages)),t.done?(v(n),n<u?setTimeout(o(n+1,1)):setTimeout(function(){!function(){var e=h.noDataFound,t="notice-success";T(a,"remove-personal-data-success"),!1===l?!1===p?e=h.noDataFound:(e=h.noneRemoved,t="notice-warning"):!1===p?e=h.foundAndRemoved:(e=h.someNotRemoved,t="notice-warning"),x(r,t,e,m),setTimeout(function(){i.removeClass("processing")},500)}()},500)):setTimeout(o(n,s+1))):setTimeout(function(){f()},500)}).fail(function(){setTimeout(function(){f()},500)})}(1,1)}),g(document).on("click",function(e){var t,o,n,s=wp.i18n.__,a=g(e.target),r=a.siblings(".success");if(clearTimeout(d),a.is("button.privacy-text-copy")&&((o=(t=a.parent().parent()).find("div.wp-suggested-text")).length||(o=t.find("div.policy-text")),o.length))try{var i=document.documentElement.scrollTop,c=document.body.scrollTop;window.getSelection().removeAllRanges(),n=document.createRange(),o.addClass("hide-privacy-policy-tutorial"),n.selectNodeContents(o[0]),window.getSelection().addRange(n),document.execCommand("copy"),o.removeClass("hide-privacy-policy-tutorial"),window.getSelection().removeAllRanges(),0<i&&i!==document.documentElement.scrollTop?document.documentElement.scrollTop=i:0<c&&c!==document.body.scrollTop&&(document.body.scrollTop=c),r.addClass("visible"),wp.a11y.speak(s("The section has been copied to your clipboard.")),d=setTimeout(function(){r.removeClass("visible")},3e3)}catch(e){}})});
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-48233';
|
||||
$wp_version = '5.5-alpha-48234';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue