long pressing a link doesn't open the context menu on iOS
Actual Behavior:
-
What is the issue? *In iOS 10, to touch and hold a link cannot bring up context menu, suppose it will bring up below context menu. http://oi63.tinypic.com/2hqf0uc.jpg -
What is the expected behavior?Bring up context menu when hold on the link(which is html a tab)
CodePen (or steps to reproduce the issue): *
CodePen Demo which shows your issue:http://codepen.io/stanleyjoey/pen/qmRodzDetails:Touch and Hold on the link cannot bring up context menu
AngularJS Versions: *
AngularJS Version:v1.5.8AngularJS Material Version:v1.1.1
Additional Information:
Browser Type: *Mobile Safari & Mobile ChromeBrowser Version: *10.0OS: *iOS 10.3.1Stack Traces:
I can reproduce this with AngularJS Material 1.1.10 and HEAD (1.1.11) using iOS 12.1.1 on both Chrome and Safari using the docs. On another random web page, long pressing links does give a menu, but not on our docs.
This appears to be related to our use of https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-touch-callout on the body. We apply -webkit-touch-callout: none;, but it's not clear why.
I tracked this style back over 5+ years ago when the project first started and at no point could I find a reason that it was added. Based on this article it appears to be a recommended pattern for PhoneGap/Cordova/Ionic apps so that a "web" looking menu doesn't show up in your Hybrid app that is trying to fake like it's Native.
For reference (from oldest to latest):
- https://github.com/angular/material/blame/ac1cea4c85e393046f24017545e00207ad41d8c1/src/core/style/_structure.scss
- https://github.com/angular/material/blame/00f4cc6d1329f618d595f887c0a13371bcff2d9e/src/core/style/structure.scss
- https://github.com/angular/material/blame/6af1546da48aa335ca65ff32f09e2d3b69d0a2d9/src/core/style/typography.scss
Other related issues I found: https://github.com/handsontable/handsontable/issues/5171
Workaround:
body {
-webkit-touch-callout: default;
}
I was able to verify the workaround on iOS Safari 12.1.
I need to gather some feedback on the impact of making this change. It seems reasonable as Angular Material removed this non-standard Webkit style as well. But I think that AngularJS Material has a lot more Ionic, Cordova, and PhoneGap users than Angular Material.
I'll make a post in the AngularJS Material forums and wait a few days for feedback.
I've posted a request for feedback here: https://groups.google.com/forum/?pli=1#!topic/ngmaterial/4Y1P671wsKM
There has been no feedback on this in almost 2 years, so I think that it's plenty safe to change it to default.