question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v2] prevent context menu on android

See original GitHub issue

This is a (multiple allowed):

  • enhancement
  • feature-discussion (RFC)

Currently, touch call-out is disabled for IOS using -webkit-touch-callout which is awesome, also same seems is added into material css but it is not working as stated in MDN it is only implemented as an experimental thing into safari.

Long tap context menu on native-like F7 apps in android chrome is little annoying. From this question seems the only available method would be preventing window.oncontextmenuevent like this:

window.oncontextmenu = function(event) {
     event.preventDefault();
     event.stopPropagation();
     return false;
};

I’ve opened this issue instead of a PR to ask first is there any reason not using this approach?

Another thing about browser-specific touch events. Is selectable text something expected?

/ping @nolimits4web

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
nolimits4webcommented, Sep 22, 2017

We can add context menu disabling at https://github.com/framework7io/Framework7/blob/v2/src/modules/touch/touch.js#L580 wrapping it with if (Device.ios || Device.android)

1reaction
J05HIcommented, Sep 22, 2017

@nolimits4web Looks fine and easy 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Disabling the context menu on long taps on Android
The context menu has its own event. You just need to catch it and stop it from propagating. window.oncontextmenu = function(event) { event....
Read more >
[Android] preventDefault() in contextmenu listener cancels ...
Expected results: 1. browser's context menu should not appear. 3. preventDefault() in "contextmenu" event handler should not cancel touch events. this bug ...
Read more >
Menus - Android Developers
Context menu and contextual action mode: A context menu is a floating menu that appears when the user performs a long-click on an...
Read more >
Removing context menu/'Powered by THEOplayer v2...'
The context menu can be removed while building your player by disabling the "contextmenu" feature or by adding a CSS rule on your...
Read more >
oncontextmenu Event - W3Schools
Example. Prevent the context menu to show: div.addEventListener ; In HTML: < ; In JavaScript: object.oncontextmenu ; In JavaScript, using the addEventListener() ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found