Skip to content
Closed
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/wp-admin/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@
padding: 0;
position: absolute;
width: 1px;
word-wrap: normal !important; /* many screen reader and browser combinations announce broken words as they would appear visually */
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;
}

.button .screen-reader-text {
Expand Down
2 changes: 2 additions & 0 deletions src/wp-admin/css/customize-controls.css
Original file line number Diff line number Diff line change
Expand Up @@ -2686,7 +2686,9 @@ body.adding-widget .add-new-widget:before,
padding: 0;
position: absolute;
width: 1px;
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;
}

#available-widgets .customize-section-title button,
Expand Down
2 changes: 2 additions & 0 deletions src/wp-admin/css/install.css
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,9 @@ body.language-chooser {
padding: 0;
position: absolute;
width: 1px;
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;
}

.spinner {
Expand Down
4 changes: 3 additions & 1 deletion src/wp-admin/css/login.css
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,9 @@ body.interim-login {
padding: 0;
position: absolute;
width: 1px;
word-wrap: normal !important; /* many screen reader and browser combinations announce broken words as they would appear visually */
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;
}

/* Hide the Edge "reveal password" native button */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
padding: 0;
position: absolute !important;
width: 1px;
word-wrap: normal !important; /* Many screen reader and browser combinations announce broken words as they would appear visually. */
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;

&:focus {
background-color: $color__background-screen;
Expand Down
3 changes: 2 additions & 1 deletion src/wp-content/themes/twentynineteen/style-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -3627,8 +3627,9 @@ body.page .main-navigation {
padding: 0;
position: absolute !important;
width: 1px;
word-wrap: normal !important;
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;
}

.screen-reader-text:focus {
Expand Down
3 changes: 2 additions & 1 deletion src/wp-content/themes/twentynineteen/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3627,8 +3627,9 @@ body.page .main-navigation {
padding: 0;
position: absolute !important;
width: 1px;
word-wrap: normal !important;
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;
}

.screen-reader-text:focus {
Expand Down
4 changes: 3 additions & 1 deletion src/wp-content/themes/twentyseventeen/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ template {
overflow: hidden;
position: absolute !important;
width: 1px;
word-wrap: normal !important; /* Many screen reader and browser combinations announce broken words as they would appear visually. */
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;
}

.screen-reader-text:focus {
Expand Down
3 changes: 2 additions & 1 deletion src/wp-content/themes/twentysixteen/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1289,8 +1289,9 @@ a:active {
overflow: hidden;
position: absolute !important;
width: 1px;
/* many screen reader and browser combinations announce broken words as they would appear visually */
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;
}

/* must have higher specificity than alternative color schemes inline styles */
Expand Down
3 changes: 2 additions & 1 deletion src/wp-content/themes/twentytwenty/style-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,9 @@ path {
padding: 0;
position: absolute !important;
width: 1px;
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal;
word-break: normal !important;
}

.screen-reader-text:focus {
Expand Down
3 changes: 2 additions & 1 deletion src/wp-content/themes/twentytwenty/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,9 @@ path {
padding: 0;
position: absolute !important;
width: 1px;
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal;
word-break: normal !important;
}

.screen-reader-text:focus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
padding: 0;
position: absolute !important;
width: 1px;
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal;
word-break: normal !important;
}

.skip-link:focus {
Expand Down
4 changes: 3 additions & 1 deletion src/wp-content/themes/twentytwentyone/style-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -5507,8 +5507,10 @@ h1.page-title {
padding: 0;
position: absolute !important;
width: 1px;

/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal;
word-break: normal !important;
}

.skip-link:focus {
Expand Down
4 changes: 3 additions & 1 deletion src/wp-content/themes/twentytwentyone/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -5555,8 +5555,10 @@ h1.page-title {
padding: 0;
position: absolute !important;
width: 1px;

/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal;
word-break: normal !important;
}

.skip-link:focus {
Expand Down
2 changes: 1 addition & 1 deletion src/wp-content/themes/twentytwentyone/style.css.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/wp-includes/css/admin-bar.css
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,9 @@ html:lang(he-il) .rtl #wpadminbar * {
padding: 0;
position: absolute;
width: 1px;
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;
}

#wpadminbar .screen-reader-shortcut {
Expand Down Expand Up @@ -815,7 +817,9 @@ html:lang(he-il) .rtl #wpadminbar * {
padding: 0;
position: absolute;
width: 1px;
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;
}

#wpadminbar .menupop li:hover > .ab-sub-wrapper,
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/css/media-views.css
Original file line number Diff line number Diff line change
Expand Up @@ -2506,7 +2506,9 @@
width: 1px;
border: 0;
margin: -1px;
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;
}

/* Reveal the menu toggle button. */
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/css/wp-block-template-skip-link.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
padding: 0;
position: absolute !important;
width: 1px;
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;
}

.skip-link.screen-reader-text:focus {
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/css/wp-embed-template.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ body {
padding: 0;
position: absolute;
width: 1px;
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;
}

/* Dashicons */
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -6166,7 +6166,9 @@ function the_block_template_skip_link() {
padding: 0;
position: absolute !important;
width: 1px;
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
Comment thread
peterwilsoncc marked this conversation as resolved.
word-wrap: normal !important;
word-wrap: break !important;
}

.skip-link.screen-reader-text:focus {
Expand Down
92 changes: 92 additions & 0 deletions src/wp-includes/theme-templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,98 @@ function wp_enqueue_block_template_skip_link() {
return;
}

$skip_link_styles = '
.skip-link.screen-reader-text {
border: 0;
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute !important;
width: 1px;
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
word-wrap: normal !important;
word-break: normal !important;
}

.skip-link.screen-reader-text:focus {
background-color: #eee;
clip-path: none;
color: #444;
display: block;
font-size: 1em;
height: auto;
left: 5px;
line-height: normal;
padding: 15px 23px 14px;
text-decoration: none;
top: 5px;
width: auto;
z-index: 100000;
}';

$handle = 'wp-block-template-skip-link';

/**
* Print the skip-link styles.
*/
wp_register_style( $handle, false );
wp_add_inline_style( $handle, $skip_link_styles );
wp_enqueue_style( $handle );

/**
* Enqueue the skip-link script.
*/
ob_start();
?>
<script>
( function() {
var skipLinkTarget = document.querySelector( 'main' ),
sibling,
skipLinkTargetID,
skipLink;

// Early exit if a skip-link target can't be located.
if ( ! skipLinkTarget ) {
return;
}

/*
* Get the site wrapper.
* The skip-link will be injected in the beginning of it.
*/
sibling = document.querySelector( '.wp-site-blocks' );

// Early exit if the root element was not found.
if ( ! sibling ) {
return;
}

// Get the skip-link target's ID, and generate one if it doesn't exist.
skipLinkTargetID = skipLinkTarget.id;
if ( ! skipLinkTargetID ) {
skipLinkTargetID = 'wp--skip-link--target';
skipLinkTarget.id = skipLinkTargetID;
}

// Create the skip link.
skipLink = document.createElement( 'a' );
skipLink.classList.add( 'skip-link', 'screen-reader-text' );
skipLink.id = 'wp-skip-link';
skipLink.href = '#' + skipLinkTargetID;
skipLink.innerText = '<?php /* translators: Hidden accessibility text. Do not use HTML entities (&nbsp;, etc.). */ esc_html_e( 'Skip to content' ); ?>';

// Inject the skip link.
sibling.parentElement.insertBefore( skipLink, sibling );
}() );
</script>
<?php
$skip_link_script = wp_remove_surrounding_empty_script_tags( ob_get_clean() );
$script_handle = 'wp-block-template-skip-link';
wp_register_script( $script_handle, false, array(), false, array( 'in_footer' => true ) );
wp_add_inline_script( $script_handle, $skip_link_script );
wp_enqueue_script( $script_handle );
wp_enqueue_style( 'wp-block-template-skip-link' );
}

Expand Down
Loading