Skip to content

Commit

Permalink
Accessibility: Globally update .screen-reader-text class.
Browse files Browse the repository at this point in the history
Remove references to the obsolete style property `clip: rect(1px, 1px, 1px, 1px);` and replace or adapt to use `clip-path: inset(50%);`. Update associated `:focus` styles as appropriate. Remove prefixed instances of `-webkit-clip-path`.

Props afercia, hbhalodia, audrasjb, joedolson, sabernhardt. 
Fixes #62238.

git-svn-id: https://develop.svn.wordpress.org/trunk@59832 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
joedolson committed Feb 17, 2025
1 parent a1440ae commit 8b68efd
Show file tree
Hide file tree
Showing 39 changed files with 47 additions and 95 deletions.
1 change: 0 additions & 1 deletion src/wp-admin/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
.screen-reader-text span,
.ui-helper-hidden-accessible {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
margin: -1px;
Expand Down
1 change: 0 additions & 1 deletion src/wp-admin/css/install.css
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ body.language-chooser {
.screen-reader-input,
.screen-reader-text {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
margin: -1px;
Expand Down
1 change: 0 additions & 1 deletion src/wp-admin/css/login.css
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ body.interim-login {
.screen-reader-text,
.screen-reader-text span {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
margin: -1px;
Expand Down
3 changes: 1 addition & 2 deletions src/wp-content/themes/twentyeleven/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,7 @@ function twentyeleven_header_style() {
#site-title,
#site-description {
position: absolute;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
}
<?php
// If the user has set a custom color for the text, use that.
Expand Down
6 changes: 3 additions & 3 deletions src/wp-content/themes/twentyeleven/inc/theme-customizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
value.bind( function( to ) {
if ( 'blank' === to ) {
$( '#site-title, #site-title a, #site-description' ).css( {
'clip': 'rect(1px, 1px, 1px, 1px)',
'clip-path': 'inset(50%)',
'position': 'absolute'
} );
} else {
$( '#site-title, #site-title a, #site-description' ).css( {
'clip': 'auto',
'clip-path': 'none',
'color': to,
'position': 'relative'
} );
}
} );
} );
} )( jQuery );
} )( jQuery );
10 changes: 3 additions & 7 deletions src/wp-content/themes/twentyeleven/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,7 @@ a:hover {
.assistive-text,
.screen-reader-text {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
overflow: hidden;
height: 1px;
width: 1px;
Expand All @@ -515,7 +514,6 @@ a.assistive-text:focus,
.screen-reader-text:focus {
background-color: #f1f1f1;
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
clip: auto !important;
clip-path: none;
color: #21759b;
display: block;
Expand Down Expand Up @@ -747,8 +745,7 @@ a.assistive-text:focus,
border-bottom: none;
}
.blog .sticky .entry-header .entry-meta {
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
position: absolute !important;
}
.entry-title,
Expand Down Expand Up @@ -1445,8 +1442,7 @@ section.featured-post .hentry {
margin: 0;
}
section.featured-post .entry-meta {
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
position: absolute !important;
}

Expand Down
2 changes: 1 addition & 1 deletion src/wp-content/themes/twentyfifteen/inc/custom-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function twentyfifteen_header_style() {
?>
.site-title,
.site-description {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
position: absolute;
}
<?php endif; ?>
Expand Down
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentyfifteen/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@ a:focus {
/* Text meant only for screen readers */
.says,
.screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute !important;
Expand Down Expand Up @@ -1199,7 +1199,7 @@ a:focus {
}

.site .skip-link:focus {
clip: auto;
clip-path: none;
height: auto;
left: 6px;
top: 7px;
Expand Down
3 changes: 1 addition & 2 deletions src/wp-content/themes/twentyfourteen/inc/custom-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ function twentyfourteen_header_style() {
?>
.site-title,
.site-description {
clip: rect(1px 1px 1px 1px); /* IE7 */
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
position: absolute;
}
<?php
Expand Down
6 changes: 3 additions & 3 deletions src/wp-content/themes/twentyfourteen/js/customizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
value.bind( function( to ) {
if ( 'blank' === to ) {
$( '.site-title, .site-description' ).css( {
'clip': 'rect(1px, 1px, 1px, 1px)',
'clip-path': 'inset(50%)',
'position': 'absolute'
} );
} else {
$( '.site-title, .site-description' ).css( {
'clip': 'auto',
'clip-path': 'none',
'position': 'static'
} );

Expand All @@ -35,4 +35,4 @@
}
} );
} );
} )( jQuery );
} )( jQuery );
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentyfourteen/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ div.wp-caption.alignright .wp-caption-text {
/* Assistive text */

.screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
overflow: hidden;
position: absolute !important;
height: 1px;
Expand All @@ -731,7 +731,7 @@ div.wp-caption.alignright .wp-caption-text {
background-color: #f1f1f1;
border-radius: 3px;
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
clip: auto;
clip-path: none;
color: #21759b;
display: block;
font-size: 14px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* Text meant only for screen readers. */
.screen-reader-text {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
margin: -1px;
Expand All @@ -15,7 +14,6 @@
background-color: $color__background-screen;
border-radius: 3px;
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
clip: auto !important;
clip-path: none;
color: $color__text-screen;
display: block;
Expand Down
2 changes: 0 additions & 2 deletions src/wp-content/themes/twentynineteen/style-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -3616,7 +3616,6 @@ body.page .main-navigation {
/* Text meant only for screen readers. */
.screen-reader-text {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
margin: -1px;
Expand All @@ -3632,7 +3631,6 @@ body.page .main-navigation {
background-color: #f1f1f1;
border-radius: 3px;
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
clip: auto !important;
clip-path: none;
color: #21759b;
display: block;
Expand Down
2 changes: 0 additions & 2 deletions src/wp-content/themes/twentynineteen/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3616,7 +3616,6 @@ body.page .main-navigation {
/* Text meant only for screen readers. */
.screen-reader-text {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
margin: -1px;
Expand All @@ -3632,7 +3631,6 @@ body.page .main-navigation {
background-color: #f1f1f1;
border-radius: 3px;
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
clip: auto !important;
clip-path: none;
color: #21759b;
display: block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function twentyseventeen_header_style() {
.site-title,
.site-description {
position: absolute;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
}
<?php
// If the user has set a custom color for the text use that.
Expand Down
10 changes: 5 additions & 5 deletions src/wp-content/themes/twentyseventeen/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ template {
/* Text meant only for screen readers. */

.screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute !important;
Expand All @@ -320,7 +320,7 @@ template {
border-radius: 3px;
-webkit-box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
clip: auto !important;
clip-path: none;
color: #21759b;
display: block;
font-size: 14px;
Expand Down Expand Up @@ -1988,7 +1988,7 @@ body.page:not(.twentyseventeen-front-page) .entry-title {
}

.page-numbers.current .screen-reader-text {
clip: auto;
clip-path: none;
height: auto;
overflow: auto;
position: relative !important;
Expand Down Expand Up @@ -3236,7 +3236,7 @@ p > object:only-child {
.no-svg .prev.page-numbers .screen-reader-text,
.no-svg .social-navigation li a .screen-reader-text,
.no-svg .search-submit .screen-reader-text {
clip: auto;
clip-path: none;
font-size: 16px;
font-size: 1rem;
font-weight: 400;
Expand Down Expand Up @@ -4173,7 +4173,7 @@ p > object:only-child {
}

.page-numbers.current .screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute !important;
Expand Down
2 changes: 1 addition & 1 deletion src/wp-content/themes/twentysixteen/inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function twentysixteen_header_style() {

.site-branding .site-title,
.site-description {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
position: absolute;
}
</style>
Expand Down
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentysixteen/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ a:active {
/* Text meant only for screen readers */
.says,
.screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute !important;
Expand Down Expand Up @@ -1316,7 +1316,7 @@ a:active {
}

.site .skip-link:focus {
clip: auto;
clip-path: none;
height: auto;
left: 6px;
top: 7px;
Expand Down
2 changes: 1 addition & 1 deletion src/wp-content/themes/twentyten/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ a:hover {

/* Text meant only for screen readers */
.screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
overflow: hidden;
position: absolute !important;
height: 1px;
Expand Down
6 changes: 2 additions & 4 deletions src/wp-content/themes/twentythirteen/inc/custom-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ function twentythirteen_header_style() {
.site-title,
.site-description {
position: absolute;
clip: rect(1px 1px 1px 1px); /* IE7 */
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
}
<?php
if ( empty( $header_image ) ) :
Expand Down Expand Up @@ -185,8 +184,7 @@ function twentythirteen_admin_header_style() {
#headimg h1,
#headimg h2 {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE7 */
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
}
<?php endif; ?>
#headimg h1 {
Expand Down
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentythirteen/js/theme-customizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
$( '.home-link' ).css( 'min-height', '0' );
}
$( '.site-title, .site-description' ).css( {
'clip': 'rect(1px, 1px, 1px, 1px)',
'clip-path': 'inset(50%)',
'position': 'absolute'
} );
} else {
$( '.home-link' ).css( 'min-height', '230px' );
$( '.site-title, .site-description' ).css( {
'clip': 'auto',
'clip-path': 'none',
'color': to,
'position': 'relative'
} );
Expand Down
10 changes: 5 additions & 5 deletions src/wp-content/themes/twentythirteen/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ hr {

/* Assistive text */
.screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
overflow: hidden;
position: absolute !important;
height: 1px;
Expand All @@ -570,7 +570,7 @@ hr {
background-color: #f1f1f1;
border-radius: 3px;
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
clip: auto !important;
clip-path: none;
color: #21759b;
display: block;
font-size: 14px;
Expand Down Expand Up @@ -921,7 +921,7 @@ div.nav-menu > ul {
height: 1px;
width: 1px;
overflow: hidden;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
}

.nav-menu .sub-menu ul,
Expand Down Expand Up @@ -949,7 +949,7 @@ ul.nav-menu li:hover > ul,
.nav-menu ul li:hover > ul,
ul.nav-menu .focus > ul,
.nav-menu .focus > ul {
clip: inherit;
clip-path: none;
overflow: inherit;
height: inherit;
width: inherit;
Expand Down Expand Up @@ -3149,7 +3149,7 @@ footer.entry-meta {
font-weight: normal;
}
.site-description {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
position: absolute;
}
.gallery {
Expand Down
3 changes: 1 addition & 2 deletions src/wp-content/themes/twentytwelve/inc/custom-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ function twentytwelve_header_style() {
.site-title,
.site-description {
position: absolute;
clip: rect(1px 1px 1px 1px); /* IE7 */
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
}
<?php
// If the user has set a custom color for the text, use that.
Expand Down
Loading

0 comments on commit 8b68efd

Please sign in to comment.