Message: Fix links system menu on Android

This commit is contained in:
Alexander Zinchuk 2021-08-23 03:38:28 +03:00
parent 64bdaae142
commit 57d7ec1e21
2 changed files with 7 additions and 2 deletions

View File

@ -54,6 +54,11 @@ export default function useOuterHandlers(
function handleContextMenu(e: React.MouseEvent<HTMLDivElement, MouseEvent>) { function handleContextMenu(e: React.MouseEvent<HTMLDivElement, MouseEvent>) {
if (IS_ANDROID) { if (IS_ANDROID) {
if (!(e.target as HTMLElement).matches('a[href]')) {
return;
}
e.preventDefault();
selectMessage(); selectMessage();
} else { } else {
onContextMenu(e); onContextMenu(e);

View File

@ -32,7 +32,7 @@ export default (
const handleContextMenu = useCallback((e: React.MouseEvent) => { const handleContextMenu = useCallback((e: React.MouseEvent) => {
document.body.classList.remove('no-selection'); document.body.classList.remove('no-selection');
if (isMenuDisabled || (shouldDisableOnLink && (e.target as HTMLElement).matches('a.text-entity-link[href]'))) { if (isMenuDisabled || (shouldDisableOnLink && (e.target as HTMLElement).matches('a[href]'))) {
return; return;
} }
e.preventDefault(); e.preventDefault();
@ -91,7 +91,7 @@ export default (
const { clientX, clientY, target } = originalEvent.touches[0]; const { clientX, clientY, target } = originalEvent.touches[0];
if (contextMenuPosition || (shouldDisableOnLink && (target as HTMLElement).matches('a.text-entity-link[href]'))) { if (contextMenuPosition || (shouldDisableOnLink && (target as HTMLElement).matches('a[href]'))) {
return; return;
} }