fix(frontend): ツールチップが永久にDOMに残ることがある問題を修正

#10805
This commit is contained in:
syuilo 2023-05-15 14:29:35 +09:00
parent f4e6d73a8a
commit 60f504bbe2
2 changed files with 15 additions and 4 deletions

View File

@ -41,6 +41,9 @@ const emit = defineEmits<{
(ev: 'closed'): void;
}>();
// showing = false closed DOM
if (!props.showing) emit('closed');
const el = shallowRef<HTMLElement>();
const zIndex = os.claimZIndex('high');

View File

@ -5,7 +5,7 @@ import { defineAsyncComponent, Directive, ref } from 'vue';
import { isTouchUsing } from '@/scripts/touch';
import { popup, alert } from '@/os';
const start = isTouchUsing ? 'touchstart' : 'mouseover';
const start = isTouchUsing ? 'touchstart' : 'mouseenter';
const end = isTouchUsing ? 'touchend' : 'mouseleave';
export default {
@ -63,16 +63,24 @@ export default {
ev.preventDefault();
});
el.addEventListener(start, () => {
el.addEventListener(start, (ev) => {
window.clearTimeout(self.showTimer);
window.clearTimeout(self.hideTimer);
self.showTimer = window.setTimeout(self.show, delay);
if (delay === 0) {
self.show();
} else {
self.showTimer = window.setTimeout(self.show, delay);
}
}, { passive: true });
el.addEventListener(end, () => {
window.clearTimeout(self.showTimer);
window.clearTimeout(self.hideTimer);
self.hideTimer = window.setTimeout(self.close, delay);
if (delay === 0) {
self.close();
} else {
self.hideTimer = window.setTimeout(self.close, delay);
}
}, { passive: true });
el.addEventListener('click', () => {