From 5f42036652112c3b9b94f81c07e6b847cc384a3a Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 27 Nov 2021 18:29:23 +0900 Subject: [PATCH] =?UTF-8?q?fix(client):=20=E3=83=A2=E3=83=90=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=81=A7=E3=82=BF=E3=83=83=E3=83=97=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=81=A8=E3=81=8D=E3=81=AB=E3=83=84=E3=83=BC=E3=83=AB=E3=83=81?= =?UTF-8?q?=E3=83=83=E3=83=97=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/client/src/os.ts | 10 ++++++++++ packages/client/src/scripts/use-tooltip.ts | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index 9eac06a5e..48a558a36 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -12,6 +12,16 @@ import { resolve } from '@/router'; import { $i } from '@/account'; import { defaultStore } from '@/store'; +export let isScreenTouching = false; + +window.addEventListener('touchstart', () => { + isScreenTouching = true; +}, { passive: true }); + +window.addEventListener('touchend', () => { + isScreenTouching = false; +}, { passive: true }); + export const stream = markRaw(new Misskey.Stream(url, $i)); export const pendingApiRequestsCount = ref(0); diff --git a/packages/client/src/scripts/use-tooltip.ts b/packages/client/src/scripts/use-tooltip.ts index 2c0c36400..89e6b1be9 100644 --- a/packages/client/src/scripts/use-tooltip.ts +++ b/packages/client/src/scripts/use-tooltip.ts @@ -1,3 +1,4 @@ +import { isScreenTouching } from '@/os'; import { Ref, ref } from 'vue'; export function useTooltip(onShow: (showing: Ref) => void) { @@ -10,6 +11,10 @@ export function useTooltip(onShow: (showing: Ref) => void) { close(); if (!isHovering) return; + // iOS(Androidも?)では、要素をタップした直後に(おせっかいで)mouseoverイベントを発火させたりするため、その対策 + // これが無いと、画面に触れてないのにツールチップが出たりしてしまう + if (!isScreenTouching) return; + const showing = ref(true); onShow(showing); changeShowingState = () => {