diff --git a/dist/jquery.contextMenu.css b/dist/jquery.contextMenu.css index 6d385ca6..8dc0afd3 100644 --- a/dist/jquery.contextMenu.css +++ b/dist/jquery.contextMenu.css @@ -7,12 +7,12 @@ * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF) * Web: http://swisnl.github.io/jQuery-contextMenu/ * - * Copyright (c) 2011-2020 SWIS BV and contributors + * Copyright (c) 2011-2025 SWIS BV and contributors * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * - * Date: 2020-05-13T13:55:37.023Z + * Date: 2025-11-04T11:10:12.861Z */ @-webkit-keyframes cm-spin { 0% { diff --git a/dist/jquery.contextMenu.js b/dist/jquery.contextMenu.js old mode 100755 new mode 100644 index 7eb96233..9dc30670 --- a/dist/jquery.contextMenu.js +++ b/dist/jquery.contextMenu.js @@ -6,12 +6,12 @@ * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF) * Web: http://swisnl.github.io/jQuery-contextMenu/ * - * Copyright (c) 2011-2020 SWIS BV and contributors + * Copyright (c) 2011-2025 SWIS BV and contributors * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * - * Date: 2020-05-13T13:55:36.983Z + * Date: 2025-11-04T11:10:13.179Z */ // jscs:disable @@ -31,6 +31,36 @@ 'use strict'; + // helper function to check for rapid interactions after menu display + var isInteractionTooFast = function($element) { + if (!('ontouchstart' in window + || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0)) { + return false; + } + var interactionTime = Date.now(); + var $liItem = $element.is('input, textarea, select') ? $element.closest('.context-menu-item') : $element; + if (!$liItem || !$liItem.length) { + return false; + } + var $parentMenu = $liItem.parent(); + if (!$parentMenu || !$parentMenu.length) { + return false; + } + + // only apply the check for items within submenus + if ($parentMenu.hasClass('context-menu-root')) { + return false; + } + + var showTimestamp = $parentMenu.data('_showTimestamp'); + var timeDifference = showTimestamp ? interactionTime - showTimestamp : Infinity; + + // threshold for fast interaction (e.g., mobile tap) + var threshold = 50; // ms + + return timeDifference < threshold; + }; + // TODO: - // ARIA stuff: menuitem, menuitemcheckbox und menuitemradio // create