diff --git a/wp-content/themes/twentyseventeen/assets/js/global.js b/wp-content/themes/twentyseventeen/assets/js/global.js index de64a9c2d7..cced97c475 100644 --- a/wp-content/themes/twentyseventeen/assets/js/global.js +++ b/wp-content/themes/twentyseventeen/assets/js/global.js @@ -26,6 +26,27 @@ menuTop = 0, resizeTimer; + /** + * Ensure the sticky navigation doesn't cover current focused links + */ + $( '#content a, #colophon a' ).focus( function() { + if ( $navigation.hasClass( 'site-navigation-fixed' ) ) { + var windowScrollTop = $( window ).scrollTop(), + fixedNavHeight = $navigation.height(), + itemScrollTop = $( this ).offset().top, + offsetDiff = itemScrollTop - windowScrollTop; + + // Account for Admin bar. + if ( $( '#wpadminbar' ).length ) { + offsetDiff -= $( '#wpadminbar' ).height(); + } + + if ( offsetDiff < fixedNavHeight ) { + $( window ).scrollTo( itemScrollTop - ( fixedNavHeight + 50 ), 600); + }; + } + } ); + /** * Sets properties of navigation */ diff --git a/wp-content/themes/twentyseventeen/functions.php b/wp-content/themes/twentyseventeen/functions.php index 79bfed78d2..de742624a6 100644 --- a/wp-content/themes/twentyseventeen/functions.php +++ b/wp-content/themes/twentyseventeen/functions.php @@ -379,16 +379,13 @@ function twentyseventeen_scripts() { wp_enqueue_script( 'twentyseventeen-global', get_theme_file_uri( '/assets/js/global.js' ), array( 'jquery' ), '1.0', true ); + wp_enqueue_script( 'jquery-scrollto', get_theme_file_uri( '/assets/js/jquery.scrollTo.js' ), array( 'jquery' ), '2.1.2', true ); + wp_localize_script( 'twentyseventeen-skip-link-focus-fix', 'twentyseventeenScreenReaderText', $twentyseventeen_l10n ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } - - // Scroll effects (only loaded on front page). - if ( is_front_page() ) { - wp_enqueue_script( 'jquery-scrollto', get_template_directory_uri() . '/assets/js/jquery.scrollTo.js', array( 'jquery' ), '2.1.2', true ); - } } add_action( 'wp_enqueue_scripts', 'twentyseventeen_scripts' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 012a0a96d2..207ed89664 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-beta2-39182'; +$wp_version = '4.7-beta2-39183'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.