浏览代码

fix(Tooltips): prevented tooltips from keeping focus when modal is opened

Signed-off-by: Jonathan <theflametrooper@gmail.com>
Jonathan 3 年之前
父节点
当前提交
4176ecd0c3

+ 14 - 0
frontend/src/components/modals/EditPlaylist/components/PlaylistSongItem.vue

@@ -32,6 +32,7 @@
 				interactive="true"
 				placement="left"
 				theme="songActions"
+				ref="songActions"
 				trigger="click"
 			>
 				<template #trigger>
@@ -111,11 +112,24 @@ export default {
 		userRole: state => state.user.auth.role
 	}),
 	methods: {
+		hideTippyElements() {
+			this.$refs.songActions.tip.hide();
+
+			setTimeout(
+				() =>
+					Array.from(
+						document.querySelectorAll(".tippy-popper")
+					).forEach(popper => popper._tippy.hide()),
+				500
+			);
+		},
 		editSongInPlaylist(song) {
+			this.hideTippyElements();
 			this.editSong(song);
 			this.openModal({ sector: "admin", modal: "editSong" });
 		},
 		reportSongInPlaylist(song) {
+			this.hideTippyElements();
 			this.reportSong(song);
 			this.openModal({ sector: "station", modal: "report" });
 		},

+ 14 - 0
frontend/src/pages/Station/components/Sidebar/Queue/QueueItem.vue

@@ -65,6 +65,7 @@
 					interactive="true"
 					placement="left"
 					theme="songActions"
+					ref="songActions"
 					trigger="click"
 				>
 					<template #trigger>
@@ -162,11 +163,24 @@ export default {
 		};
 	},
 	methods: {
+		hideTippyElements() {
+			this.$refs.songActions.tip.hide();
+
+			setTimeout(
+				() =>
+					Array.from(
+						document.querySelectorAll(".tippy-popper")
+					).forEach(popper => popper._tippy.hide()),
+				500
+			);
+		},
 		report(song) {
+			this.hideTippyElements();
 			this.reportSong(song);
 			this.openModal({ sector: "station", modal: "report" });
 		},
 		edit(song) {
+			this.hideTippyElements();
 			this.editSong(song);
 			this.openModal({ sector: "admin", modal: "editSong" });
 		},