From b2fbb51ec3a3c93d921047431a9ebe6be8853272 Mon Sep 17 00:00:00 2001 From: sarequl Date: Sun, 1 Nov 2026 12:56:42 +0000 Subject: [PATCH] Menus: Fix expanding menu items on touch devices. Touch Punch treats any touchmove on the sortable handle as a drag and suppresses the click, so tapping the disclosure arrow with slight finger movement never opened the item. Keep touches on the edit link from reaching the sortable so the browser can fire the click. --- src/js/_enqueues/lib/nav-menu.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/js/_enqueues/lib/nav-menu.js b/src/js/_enqueues/lib/nav-menu.js index 5e94a2b34f3c9..8d322e43b2cde 100644 --- a/src/js/_enqueues/lib/nav-menu.js +++ b/src/js/_enqueues/lib/nav-menu.js @@ -1013,6 +1013,18 @@ } }); + /* + * Touch Punch treats any touchmove on the sortable handle as a drag and + * suppresses the click, so a tap on the edit link that moves even one + * pixel never opens the menu item. Keep touches on the link from reaching + * the sortable, and let the browser fire the click. + */ + api.menuList[0].addEventListener( 'touchstart', function( event ) { + if ( event.target.closest && event.target.closest( '.item-edit' ) ) { + event.stopPropagation(); + } + }, true ); + /** * Updates the shared variables used to determine the depth of the menu item being moved. *