Skip to content

Commit

Permalink
fix(frontend): use-tooltip の呼び出し元の UI が無くなったら自動的に削除されるようにする (misskey-…
Browse files Browse the repository at this point in the history
…dev#11949)

* Update use-tooltip.ts

* Update CHANGELOG.md
  • Loading branch information
YAVIIGI authored and typeling1578 committed Oct 4, 2023
1 parent 317dc5b commit 96d5b56
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Enhance: AiScriptでホストのアドレスを参照する定数`SERVER_URL`を追加
- Enhance: モデレーションログ機能の強化
- Enhance: ローカリゼーションの更新
- Fix: リアクションしたユーザ一覧のUIが稀に左上に残ってしまう不具合を修正

### Server
- Fix: Redisに古いバージョンのキャッシュが残っている場合、キャッシュが消えるまでの間通知が届かなくなる問題を修正
Expand Down
14 changes: 14 additions & 0 deletions packages/frontend/src/scripts/use-tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export function useTooltip(

let changeShowingState: (() => void) | null;

let autoHidingTimer;

const open = () => {
close();
if (!isHovering) return;
Expand All @@ -33,6 +35,16 @@ export function useTooltip(
changeShowingState = () => {
showing.value = false;
};

autoHidingTimer = window.setInterval(() => {
if (!document.body.contains(elRef.value)) {
if (!isHovering) return;
isHovering = false;
window.clearTimeout(timeoutId);
close();
window.clearInterval(autoHidingTimer);
}
}, 1000);
};

const close = () => {
Expand All @@ -53,6 +65,7 @@ export function useTooltip(
if (!isHovering) return;
isHovering = false;
window.clearTimeout(timeoutId);
window.clearInterval(autoHidingTimer);
close();
};

Expand All @@ -67,6 +80,7 @@ export function useTooltip(
if (!isHovering) return;
isHovering = false;
window.clearTimeout(timeoutId);
window.clearInterval(autoHidingTimer);
close();
};

Expand Down

0 comments on commit 96d5b56

Please sign in to comment.