Twenty Seventeen: Fixes focused controls hidden by top menu.

When a page is scrolled, the top nav menu became fixed. This resolves that.

Props afercia, Fencer04, davidakennedy
Fixes #38476


Built from https://develop.svn.wordpress.org/trunk@39183


git-svn-id: http://core.svn.wordpress.org/trunk@39123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Tammie Lister 2016-11-09 16:13:34 +00:00
parent a2bbbddb9e
commit 6c435f5afb
3 changed files with 24 additions and 6 deletions

View File

@ -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
*/

View File

@ -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' );

View File

@ -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.