[v2] prevent context menu on android
See original GitHub issueThis 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.
![](https://user-images.githubusercontent.com/5158436/30731780-424753fa-9f7c-11e7-81a1-3279d9ad8460.png)
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.oncontextmenu
event 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?
![](https://user-images.githubusercontent.com/5158436/30731656-8ca2a0ae-9f7b-11e7-9cef-e2b60dba27ec.png)
/ping @nolimits4web
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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)
@nolimits4web Looks fine and easy 😃