Skip to content

Commit

Permalink
fix conditionally adding skipLink
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Jun 4, 2021
1 parent e038551 commit c27606f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/full-site-editing/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,16 @@ function gutenberg_the_skip_link() {
return;
}

// Early exit if not an FSE theme.
// Early exit if not a block theme.
if ( ! gutenberg_supports_block_templates() ) {
return;
}

// Early exit if not a block template.
global $_wp_current_template_content;
if ( ! $_wp_current_template_content ) {
return;
}
?>

<?php
Expand Down Expand Up @@ -249,7 +255,12 @@ function gutenberg_the_skip_link() {

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

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

// Get the skip-link target's ID, and generate one if it doesn't exist.
skipLinkTargetID = skipLinkTarget.id;
Expand Down

0 comments on commit c27606f

Please sign in to comment.