Browse Source

fix(AdvancedTable): rows wouldn't unhighlight when clicking elsewhere

Kristian Vos 3 years ago
parent
commit
bd51e4e84c
1 changed files with 7 additions and 0 deletions
  1. 7 0
      frontend/src/components/AdvancedTable.vue

+ 7 - 0
frontend/src/components/AdvancedTable.vue

@@ -607,6 +607,7 @@
 							}"
 							:ref="`row-${itemIndex}`"
 							tabindex="0"
+							@blur="unhighlightRow(itemIndex)"
 							@keydown.up.prevent
 							@keydown.down.prevent
 							@keydown.space.prevent
@@ -1572,6 +1573,12 @@ export default {
 			// Set the item to be highlighted
 			this.rows[itemIndex].highlighted = true;
 		},
+		unhighlightRow(itemIndex) {
+			const rowElement = this.$refs[`row-${itemIndex}`];
+			if (rowElement) rowElement.blur();
+			// Set the item to no longer be highlighted
+			this.rows[itemIndex].highlighted = false;
+		},
 		selectUp(itemIndex) {
 			if (itemIndex === 0) return;
 			const newItemIndex = itemIndex - 1;