Ticket #45713: 45713.patch
| File 45713.patch, 9.4 KB (added by , 8 years ago) |
|---|
-
src/wp-content/themes/twentynineteen/inc/template-functions.php
203 203 if ( 'menu-1' === $args->theme_location ) : 204 204 205 205 $nav_menu .= '<div class="main-menu-more">'; 206 $nav_menu .= '<ul class="main-menu" tabindex="0">';206 $nav_menu .= '<ul class="main-menu">'; 207 207 $nav_menu .= '<li class="menu-item menu-item-has-children">'; 208 $nav_menu .= '< a href="#" class="screen-reader-text" aria-label="More" aria-haspopup="true" aria-expanded="false">' . esc_html__( 'More', 'twentynineteen' ) . '</a>';209 $nav_menu .= '<span class="s ubmenu-expand main-menu-more-toggle is-empty" tabindex="-1">';208 $nav_menu .= '<button class="submenu-expand main-menu-more-toggle is-empty" tabindex="-1" aria-label="More" aria-haspopup="true" aria-expanded="false">'; 209 $nav_menu .= '<span class="screen-reader-text">' . esc_html__( 'More', 'twentynineteen' ) . '</span>'; 210 210 $nav_menu .= twentynineteen_get_icon_svg( 'arrow_drop_down_ellipsis' ); 211 $nav_menu .= '</ span>';211 $nav_menu .= '</button>'; 212 212 $nav_menu .= '<ul class="sub-menu hidden-links">'; 213 213 $nav_menu .= '<li id="menu-item--1" class="mobile-parent-nav-menu-item menu-item--1">'; 214 $nav_menu .= '< span class="menu-item-link-return">';214 $nav_menu .= '<button class="menu-item-link-return">'; 215 215 $nav_menu .= twentynineteen_get_icon_svg( 'chevron_left' ); 216 216 $nav_menu .= esc_html__( 'Back', 'twentynineteen' ); 217 $nav_menu .= '</ span>';217 $nav_menu .= '</button>'; 218 218 $nav_menu .= '</li>'; 219 219 $nav_menu .= '</ul>'; 220 220 $nav_menu .= '</li>'; … … 269 269 // Inject the keyboard_arrow_left SVG inside the parent nav menu item, and let the item link to the parent item. 270 270 // @todo Only do this for nested submenus? If on a first-level submenu, then really the link could be "#" since the desire is to remove the target entirely. 271 271 $link = sprintf( 272 '< span class="menu-item-link-return" tabindex="-1">%s',272 '<button class="menu-item-link-return" tabindex="-1">%s', 273 273 twentynineteen_get_icon_svg( 'chevron_left', 24 ) 274 274 ); 275 275 276 // replace opening <a> with < span>276 // replace opening <a> with <button> 277 277 $output = preg_replace( 278 278 '/<a\s.*?>/', 279 279 $link, … … 281 281 1 // Limit. 282 282 ); 283 283 284 // replace closing </a> with </ span>284 // replace closing </a> with </button> 285 285 $output = preg_replace( 286 286 '#</a>#i', 287 '</ span>',287 '</button>', 288 288 $output, 289 289 1 // Limit. 290 290 ); … … 295 295 $icon = twentynineteen_get_icon_svg( 'keyboard_arrow_down', 24 ); 296 296 297 297 $output .= sprintf( 298 '< span class="submenu-expand" tabindex="-1">%s</span>',298 '<button class="submenu-expand" tabindex="-1">%s</button>', 299 299 $icon 300 300 ); 301 301 } -
src/wp-content/themes/twentynineteen/js/touch-keyboard-navigation.js
112 112 currentSubMenu.parentElement.lastElementChild.className += ' expanded-true'; 113 113 114 114 // Update aria-expanded state 115 toggleAriaExpandedState( currentSubMenu .previousSibling);115 toggleAriaExpandedState( currentSubMenu ); 116 116 } 117 117 118 118 /** … … 240 240 openSubMenu(event.target); 241 241 242 242 // Check if child of .submenu-expand is touched 243 } else if ( null != getCurrentParent( event.target, '.submenu-expand' ) && getCurrentParent( event.target, '.submenu-expand' ).matches( '.submenu-expand' ) ) { 243 } else if ( null != getCurrentParent( event.target, '.submenu-expand' ) && 244 getCurrentParent( event.target, '.submenu-expand' ).matches( '.submenu-expand' ) ) { 244 245 openSubMenu( getCurrentParent( event.target, '.submenu-expand' ) ); 245 246 246 247 // Check if .menu-item-link-return is touched … … 264 265 if ( null != mainNav && hasClass( mainNav, '.main-navigation' ) ) { 265 266 // Prevent default mouse events 266 267 event.preventDefault(); 268 267 269 } else if ( 268 270 event.target.matches('.submenu-expand') || 269 271 null != getCurrentParent( event.target, '.submenu-expand' ) && -
src/wp-content/themes/twentynineteen/sass/navigation/_menu-main-navigation.scss
13 13 display: inline; 14 14 } 15 15 16 /* Un-style buttons */ 17 button { 18 display: inline-block; 19 border: none; 20 padding: 0; 21 margin: 0; 22 font-family: $font__heading; 23 font-weight: 700; 24 line-height: $font__line-height-heading; 25 text-decoration: none; 26 background: transparent; 27 color: inherit; 28 cursor: pointer; 29 transition: background 250ms ease-in-out, 30 transform 150ms ease; 31 -webkit-appearance: none; 32 -moz-appearance: none; 33 34 &:hover, 35 &:focus { 36 background: transparent; 37 } 38 39 &:focus { 40 outline: 1px solid transparent; 41 outline-offset: -4px; 42 } 43 44 &:active { 45 transform: scale(0.99); 46 } 47 } 48 16 49 .main-menu { 17 50 18 51 display: inline-block; … … 182 215 } 183 216 } 184 217 218 > .menu-item-link-return { 219 width: 100%; 220 font-size: $font__size_base; 221 font-weight: normal; 222 text-align: left; 223 } 224 185 225 > a:empty { 186 226 display: none; 187 227 } -
src/wp-content/themes/twentynineteen/style-rtl.css
1027 1027 .main-navigation { 1028 1028 display: block; 1029 1029 margin-top: 0.25rem; 1030 /* Un-style buttons */ 1030 1031 /* 1031 1032 * Sub-menu styles 1032 1033 * … … 1049 1050 display: inline; 1050 1051 } 1051 1052 1053 .main-navigation button { 1054 display: inline-block; 1055 border: none; 1056 padding: 0; 1057 margin: 0; 1058 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; 1059 font-weight: 700; 1060 line-height: 1.2; 1061 text-decoration: none; 1062 background: transparent; 1063 color: inherit; 1064 cursor: pointer; 1065 transition: background 250ms ease-in-out, transform 150ms ease; 1066 -webkit-appearance: none; 1067 -moz-appearance: none; 1068 } 1069 1070 .main-navigation button:hover, .main-navigation button:focus { 1071 background: transparent; 1072 } 1073 1074 .main-navigation button:focus { 1075 outline: 1px solid transparent; 1076 outline-offset: -4px; 1077 } 1078 1079 .main-navigation button:active { 1080 transform: scale(0.99); 1081 } 1082 1052 1083 .main-navigation .main-menu { 1053 1084 display: inline-block; 1054 1085 margin: 0; … … 1206 1237 background: #005177; 1207 1238 } 1208 1239 1240 .main-navigation .sub-menu > li > .menu-item-link-return { 1241 width: 100%; 1242 font-size: 22px; 1243 font-weight: normal; 1244 text-align: right; 1245 } 1246 1209 1247 .main-navigation .sub-menu > li > a:empty { 1210 1248 display: none; 1211 1249 } -
src/wp-content/themes/twentynineteen/style.css
6 6 Author URI: https://wordpress.org/ 7 7 Description: A new Gutenberg-ready theme. 8 8 Requires at least: WordPress 4.9.6 9 Version: 1. 19 Version: 1.0 10 10 License: GNU General Public License v2 or later 11 11 License URI: LICENSE 12 12 Text Domain: twentynineteen … … 1027 1027 .main-navigation { 1028 1028 display: block; 1029 1029 margin-top: 0.25rem; 1030 /* Un-style buttons */ 1030 1031 /* 1031 1032 * Sub-menu styles 1032 1033 * … … 1049 1050 display: inline; 1050 1051 } 1051 1052 1053 .main-navigation button { 1054 display: inline-block; 1055 border: none; 1056 padding: 0; 1057 margin: 0; 1058 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; 1059 font-weight: 700; 1060 line-height: 1.2; 1061 text-decoration: none; 1062 background: transparent; 1063 color: inherit; 1064 cursor: pointer; 1065 transition: background 250ms ease-in-out, transform 150ms ease; 1066 -webkit-appearance: none; 1067 -moz-appearance: none; 1068 } 1069 1070 .main-navigation button:hover, .main-navigation button:focus { 1071 background: transparent; 1072 } 1073 1074 .main-navigation button:focus { 1075 outline: 1px solid transparent; 1076 outline-offset: -4px; 1077 } 1078 1079 .main-navigation button:active { 1080 transform: scale(0.99); 1081 } 1082 1052 1083 .main-navigation .main-menu { 1053 1084 display: inline-block; 1054 1085 margin: 0; … … 1206 1237 background: #005177; 1207 1238 } 1208 1239 1240 .main-navigation .sub-menu > li > .menu-item-link-return { 1241 width: 100%; 1242 font-size: 22px; 1243 font-weight: normal; 1244 text-align: left; 1245 } 1246 1209 1247 .main-navigation .sub-menu > li > a:empty { 1210 1248 display: none; 1211 1249 } -
src/wp-content/themes/twentynineteen/template-parts/header/site-branding.php
36 36 array( 37 37 'theme_location' => 'menu-1', 38 38 'menu_class' => 'main-menu', 39 'items_wrap' => '<ul id="%1$s" class="%2$s" tabindex="0">%3$s</ul>',39 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 40 40 ) 41 41 ); 42 42 ?>
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)