Skip to content

Commit

Permalink
Masterbar: Restore Woo Express JITM (#34167)
Browse files Browse the repository at this point in the history
* Masterbar: Restore Woo Express JITM

* changelog
  • Loading branch information
danielbachhuber authored Nov 19, 2023
1 parent 0259c84 commit b22a850
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/fix-woo-free-trial-jitm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: bugfix

Restores Woo Express free trial upgrade JITM
54 changes: 26 additions & 28 deletions projects/plugins/jetpack/modules/masterbar/admin-menu/admin-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,42 @@
return;
}

var adminbarBlogMenuList = adminbar.querySelector( '#wp-admin-bar-blog > .ab-sub-wrapper ul' );
if ( ! adminbarBlogMenuList ) {
return;
}

function setAriaExpanded( value ) {
var anchors = adminbar.querySelectorAll( '#wp-admin-bar-blog a' );
for ( var i = 0; i < anchors.length; i++ ) {
anchors[ i ].setAttribute( 'aria-expanded', value );
}
}

setFocusOnActiveMenuItem();
setAriaExpanded( 'false' );

var adminbarBlog = adminbar.querySelector( '#wp-admin-bar-blog' );
// Toggle sidebar when toggle is clicked.
if ( adminbarBlog ) {
adminbarBlog.addEventListener( 'click', function ( event ) {
event.preventDefault();
var adminbarBlogMenuList = adminbar.querySelector( '#wp-admin-bar-blog > .ab-sub-wrapper ul' );
if ( adminbarBlogMenuList ) {
setFocusOnActiveMenuItem();
setAriaExpanded( 'false' );

var adminbarBlog = adminbar.querySelector( '#wp-admin-bar-blog' );
// Toggle sidebar when toggle is clicked.
if ( adminbarBlog ) {
adminbarBlog.addEventListener( 'click', function ( event ) {
event.preventDefault();

// Close any open toolbar submenus.
var hovers = adminbar.querySelectorAll( '.hover' );
for ( var i = 0; i < hovers.length; i++ ) {
hovers[ i ].classList.remove( 'hover' );
}
// Close any open toolbar submenus.
var hovers = adminbar.querySelectorAll( '.hover' );
for ( var i = 0; i < hovers.length; i++ ) {
hovers[ i ].classList.remove( 'hover' );
}

wpwrap.classList.toggle( 'wp-responsive-open' );
if ( wpwrap.classList.contains( 'wp-responsive-open' ) ) {
setAriaExpanded( 'true' );
var first = document.querySelector( '#adminmenu a' );
if ( first ) {
first.focus();
wpwrap.classList.toggle( 'wp-responsive-open' );
if ( wpwrap.classList.contains( 'wp-responsive-open' ) ) {
setAriaExpanded( 'true' );
var first = document.querySelector( '#adminmenu a' );
if ( first ) {
first.focus();
}
} else {
setAriaExpanded( 'false' );
}
} else {
setAriaExpanded( 'false' );
}
} );
} );
}
}

if ( adminMenu ) {
Expand Down

0 comments on commit b22a850

Please sign in to comment.