Explorar o código

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

Kristian Vos %!s(int64=3) %!d(string=hai) anos
pai
achega
bd51e4e84c
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  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;