Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AMP validation errors regarding amp-accordion and missing role=button #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions classes/class-twentynineteen-walker-amp-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0
if ( $this->has_children ) {
$this->start_accordion( $output, $depth );

$output .= '<li ' . $class_names . '>';
$output .= '<h2 ' . $class_names . '>';
$output .= $this->get_anchor_tag( $item, $depth, $args, $id );
$output .= '</li>';
$output .= '</h2>';

$this->start_accordion_child_wrapper( $output, $depth );

Expand Down Expand Up @@ -155,7 +155,6 @@ public function start_accordion( &$output, $depth = 0 ) {
$output .= '<li class="menu-item-has-children"><amp-accordion><section>';

$this->accordion_started = TRUE;
$this->enqueue_accordion = TRUE;
}


Expand Down
17 changes: 0 additions & 17 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,23 +274,6 @@ function twentynineteen_scripts() {
}
add_action( 'wp_enqueue_scripts', 'twentynineteen_scripts' );

/**
* Enqueue AMP scripts.
*/
function twentynineteen_amp_scripts( $data ) {

$custom_component_scripts = array(
'amp-sidebar' => 'https://cdn.ampproject.org/v0/amp-sidebar-0.1.js',
'amp-accordion' => 'https://cdn.ampproject.org/v0/amp-accordion-0.1.js',
'amp-bind' => 'https://cdn.ampproject.org/v0/amp-bind-0.1.js',
'amp-live-list' => 'https://cdn.ampproject.org/v0/amp-live-list-0.1.js'
);
$data['component_scripts'] = array_merge( $data['component_scripts'], $custom_component_scripts );
return $data;

}
add_action( 'amp_post_template_data', 'twentynineteen_amp_scripts' );

/**
* Fix skip link focus in IE11.
*
Expand Down
2 changes: 1 addition & 1 deletion inc/template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ function twentynineteen_render_amp_nav() {
function twentynineteen_add_back_link_amp_menu( $items, $args ) {
if ( $args->theme_location == 'menu-1' ) {
// Add a close link as the first menu item.
$close = '<li on="tap:site-navigation.close" class="mobile-amp-nav-menu-item" tabindex="-1"><button class="menu-item-link-return">%1$s%2$s</button></li>';
$close = '<li on="tap:site-navigation.close" role="button" class="mobile-amp-nav-menu-item" tabindex="-1"><button class="menu-item-link-return">%1$s%2$s</button></li>';

$close = sprintf( $close,
twentynineteen_get_icon_svg( 'chevron_left', 24 ),
Expand Down