Browse Source

fix(Confirm): fixed issue with confirm component not activating on double-click or shift-click

Kristian Vos 3 years ago
parent
commit
b50671deb9
1 changed files with 12 additions and 4 deletions
  1. 12 4
      frontend/src/components/Confirm.vue

+ 12 - 4
frontend/src/components/Confirm.vue

@@ -7,10 +7,12 @@
 		ref="confirm"
 		trigger="click"
 		:append-to="body"
-		@onHide="clickedOnce = false"
 		@hide="delayedHide()"
 	>
-		<div @click.shift.stop="confirm()" @click.exact="clickedOnce = true">
+		<div
+			@click.shift.stop="shiftClick($event)"
+			@click.exact="click($event)"
+		>
 			<slot ref="trigger" />
 		</div>
 		<template #content>
@@ -45,8 +47,7 @@ export default {
 				event.type !== "click" ||
 				event.altKey ||
 				event.ctrlKey ||
-				event.metaKey ||
-				event.shiftKey
+				event.metaKey
 			)
 				return;
 
@@ -54,6 +55,13 @@ export default {
 			this.$emit("confirm");
 			this.$refs.confirm.tippy.hide();
 		},
+		click(event) {
+			if (!this.clickedOnce) this.clickedOnce = true;
+			else this.confirm(event);
+		},
+		shiftClick(event) {
+			this.confirm(event);
+		},
 		delayedHide() {
 			setTimeout(() => {
 				this.clickedOnce = false;