Skip to content

Commit

Permalink
fix(core): handle contextmenu event
Browse files Browse the repository at this point in the history
fixes #6692
  • Loading branch information
nolimits4web committed Aug 9, 2023
1 parent 703d13b commit 721ccaf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/core/events/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const events = (swiper, method) => {
document[domMethod]('pointercancel', swiper.onTouchEnd, { passive: true });
document[domMethod]('pointerout', swiper.onTouchEnd, { passive: true });
document[domMethod]('pointerleave', swiper.onTouchEnd, { passive: true });
document[domMethod]('contextmenu', swiper.onTouchEnd, { passive: true });

// Prevent Links Clicks
if (params.preventClicks || params.preventClicksPropagation) {
Expand Down
5 changes: 3 additions & 2 deletions src/core/events/onTouchEnd.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ export default function onTouchEnd(event) {
if (pointerIndex >= 0) {
data.evCache.splice(pointerIndex, 1);
}
if (['pointercancel', 'pointerout', 'pointerleave'].includes(event.type)) {
if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(event.type)) {
const proceed =
event.type === 'pointercancel' && (swiper.browser.isSafari || swiper.browser.isWebView);
['pointercancel', 'contextmenu'].includes(event.type) &&
(swiper.browser.isSafari || swiper.browser.isWebView);
if (!proceed) {
return;
}
Expand Down

0 comments on commit 721ccaf

Please sign in to comment.