Fix issue with mobile Safari showing the native selection menu when long-pressing on the map

This commit is contained in:
Quincy Morgan
2020-10-27 16:01:00 -04:00
parent 6ef1f791ad
commit 2ee53670c8
2 changed files with 16 additions and 0 deletions

View File

@@ -2876,6 +2876,12 @@ img.tag-reference-wiki-image {
.over-map > * {
pointer-events: auto;
}
/* offscreen this without hiding it */
.over-map .select-trap {
position: absolute;
right: -1000%;
opacity: 0;
}
/* Map Controls
------------------------------------------------------- */
@@ -4064,6 +4070,7 @@ img.tile-debug {
background: #000;
user-select: none;
touch-action: none;
-webkit-touch-callout: none;
}
.main-map * {
touch-action: none;

View File

@@ -163,6 +163,15 @@ export function uiInit(context) {
.append('div')
.attr('class', 'over-map');
// HACK: Mobile Safari 14 likes to select anything selectable when long-
// pressing, even if it's not targeted. This conflicts with long-pressing
// to show the edit menu. We add a selectable offscreen element as the first
// child to trick Safari into not showing the selection UI.
overMap
.append('div')
.attr('class', 'select-trap')
.text('t');
overMap
.append('div')
.attr('class', 'spinner')