Chat List: Fix context menu being stuck on tap

This commit is contained in:
Alexander Zinchuk 2023-07-23 10:08:02 +02:00
parent 90e86cfaae
commit f900ae285c

View File

@ -95,14 +95,14 @@ const useContextMenuHandlers = (
} }
// Temporarily intercept and clear the next click // Temporarily intercept and clear the next click
element.addEventListener('touchend', (e) => { document.addEventListener('touchend', (e) => {
// On iOS in PWA mode, the context menu may cause click-through to the element in the menu upon opening // On iOS in PWA mode, the context menu may cause click-through to the element in the menu upon opening
if (IS_IOS && IS_PWA) { if (IS_IOS && IS_PWA) {
setTimeout(() => { setTimeout(() => {
element.removeEventListener('mousedown', stopEvent, { document.removeEventListener('mousedown', stopEvent, {
capture: true, capture: true,
}); });
element.removeEventListener('click', stopEvent, { document.removeEventListener('click', stopEvent, {
capture: true, capture: true,
}); });
}, IOS_PWA_CONTEXT_MENU_DELAY_MS); }, IOS_PWA_CONTEXT_MENU_DELAY_MS);
@ -115,11 +115,11 @@ const useContextMenuHandlers = (
// On iOS15, in PWA mode, the context menu immediately closes after opening // On iOS15, in PWA mode, the context menu immediately closes after opening
if (IS_PWA && IS_IOS) { if (IS_PWA && IS_IOS) {
element.addEventListener('mousedown', stopEvent, { document.addEventListener('mousedown', stopEvent, {
once: true, once: true,
capture: true, capture: true,
}); });
element.addEventListener('click', stopEvent, { document.addEventListener('click', stopEvent, {
once: true, once: true,
capture: true, capture: true,
}); });