fix: suppress native iOS callout on mobile long-press
Add -webkit-touch-callout: none on mobile viewports to prevent the native iOS copy/lookup popup from racing with our context menu. Clear any text selection when the long-press timer fires.
This commit is contained in:
@@ -560,6 +560,8 @@ function useGlobalLongPress(isMobile: boolean) {
|
|||||||
timer = setTimeout(() => {
|
timer = setTimeout(() => {
|
||||||
timer = null;
|
timer = null;
|
||||||
fired = true;
|
fired = true;
|
||||||
|
// Clear any native text selection that started during the hold
|
||||||
|
window.getSelection()?.removeAllRanges();
|
||||||
// Dispatch synthetic contextmenu on the original target.
|
// Dispatch synthetic contextmenu on the original target.
|
||||||
// React's event delegation picks it up and fires onContextMenu handlers.
|
// React's event delegation picks it up and fires onContextMenu handlers.
|
||||||
const syntheticEvent = new MouseEvent('contextmenu', {
|
const syntheticEvent = new MouseEvent('contextmenu', {
|
||||||
|
|||||||
@@ -99,6 +99,15 @@
|
|||||||
text-rendering: optimizeLegibility;
|
text-rendering: optimizeLegibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Suppress native long-press callout on mobile (iOS "Copy/Lookup" popup).
|
||||||
|
Our global useLongPress handler provides context menus instead.
|
||||||
|
Text can still be copied via context menu "Copy Text" option. */
|
||||||
|
@media (max-width: 767px) {
|
||||||
|
* {
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Thin scrollbar */
|
/* Thin scrollbar */
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
width: 8px;
|
width: 8px;
|
||||||
|
|||||||
Reference in New Issue
Block a user