fix: prevent native text selection on mobile long-press
iOS triggered both the app context menu and native text selection overlay on long-press. Three-layer fix: CSS user-select:none on buttons/[role=button]/ [data-context-menu] elements; non-passive touchstart listener with conditional preventDefault on context-menu targets; removeAllRanges() at timer fire to clear any residual selection. Added data-context-menu to all mobile surfaces that use onContextMenu handlers.
This commit is contained in:
@@ -99,13 +99,18 @@
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
|
||||
/* Suppress native long-press callout on mobile (iOS "Copy/Lookup" popup).
|
||||
Our global useLongPress handler provides context menus instead.
|
||||
/* Suppress native text selection and callout on mobile interactive elements.
|
||||
Our global useGlobalLongPress handler provides context menus instead.
|
||||
Text can still be copied via context menu "Copy Text" option. */
|
||||
@media (max-width: 767px) {
|
||||
* {
|
||||
-webkit-touch-callout: none;
|
||||
}
|
||||
|
||||
button, [role="button"], [data-context-menu] {
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Thin scrollbar */
|
||||
|
||||
Reference in New Issue
Block a user