Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(frontend): use-tooltip の呼び出し元の UI が無くなったら自動的に削除されるようにする #11949

Merged
merged 3 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading