From 25ef84077900237c999c8e10f465e6b06377dc00 Mon Sep 17 00:00:00 2001 From: Khokan Sardar Date: Wed, 22 Jul 2026 15:15:03 +0530 Subject: [PATCH] Menus: Prevent lost first click on the sticky footer buttons. The focus handler that keeps menu-item fields from being hidden behind the sticky footer also matched the footer's own Save Menu and Delete Menu controls. Focusing one of those on mousedown scrolled the page, moving the control out from under the pointer, so the mouseup and click landed on an ancestor element and the delegated click handler never ran. The first click was silently lost; only a second click worked. Skip the scroll-into-view adjustment when the focused control is inside the #nav-menu-footer, which is always visible in the viewport while sticky and so never needs to be scrolled into view. Fixes #65684. --- src/js/_enqueues/lib/nav-menu.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/js/_enqueues/lib/nav-menu.js b/src/js/_enqueues/lib/nav-menu.js index 79917c8447f1a..d0eefe0702c32 100644 --- a/src/js/_enqueues/lib/nav-menu.js +++ b/src/js/_enqueues/lib/nav-menu.js @@ -1869,6 +1869,12 @@ // Prevent focused element from being hidden by the sticky footer. $( '.menu-edit a, .menu-edit button, .menu-edit input, .menu-edit textarea, .menu-edit select' ).on('focus', function() { + // The sticky footer's own controls are always in view, so scrolling + // to reveal them would shift the footer out from under the pointer + // mid-click and drop the Save or Delete activation. See #65684. + if ( $( this ).closest( '#nav-menu-footer' ).length ) { + return; + } if ( window.innerWidth >= 783 ) { var navMenuHeight = $( '#nav-menu-footer' ).height() + 20; var bottomOffset = $(this).offset().top - ( $(window).scrollTop() + $(window).height() - $(this).height() );