Twenty Fourteen: provide keyboard support for the primary navigation, props joedolson. See #25054.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2013-10-08 17:56:09 +00:00
parent 4cfe0fe5e2
commit bb63cf3c40
2 changed files with 21 additions and 5 deletions

View File

@ -117,4 +117,16 @@
} ); } );
/* Accessibility hover styles for menu. */
$( '.primary-navigation li' ).hover( function() {
$( this ).addClass( 'a11y-focus' );
}, function() {
$( this ).delay( '250' ).removeClass( 'a11y-focus' );
}
);
$( '.primary-navigation li a' ).on( 'focus blur', function() {
$( this ).parents().toggleClass( 'a11y-focus' );
}
);
} )( jQuery ); } )( jQuery );

View File

@ -685,11 +685,10 @@ body {
} }
.primary-navigation ul ul { .primary-navigation ul ul {
background-color: rgba(0, 0, 0, 0.9); background-color: rgba(0, 0, 0, 0.9);
display: none;
float: left; float: left;
position: absolute; position: absolute;
top: 48px; top: 48px;
left: 0; left: -999em;
z-index: 99999; z-index: 99999;
} }
.primary-navigation li li { .primary-navigation li li {
@ -698,7 +697,7 @@ body {
line-height: 1.6363636363; line-height: 1.6363636363;
} }
.primary-navigation ul ul ul { .primary-navigation ul ul ul {
left: 100%; left: -999em;
top: 0; top: 0;
} }
.primary-navigation ul ul a { .primary-navigation ul ul a {
@ -715,8 +714,13 @@ body {
.primary-navigation ul ul a:hover { .primary-navigation ul ul a:hover {
color: #8c8c8c; color: #8c8c8c;
} }
.primary-navigation ul li:hover > ul { .primary-navigation ul li:hover > ul,
display: block; .primary-navigation ul li.a11y-focus > ul {
left: auto;
}
.primary-navigation ul ul li:hover > ul,
.primary-navigation ul ul li.a11y-focus > ul {
left: 100%;
} }
.primary-navigation li.current_page_item > a, .primary-navigation li.current_page_item > a,
.primary-navigation li.current-menu-item > a { .primary-navigation li.current-menu-item > a {