diff --git a/src/components/tabs/WikiListTab.vue b/src/components/tabs/WikiListTab.vue index 5edaa30..60c582d 100644 --- a/src/components/tabs/WikiListTab.vue +++ b/src/components/tabs/WikiListTab.vue @@ -50,7 +50,7 @@ :data-preview="vehicle.type === store.chosenVehicle?.type" @click="previewVehicle(vehicle)" @dblclick="addVehicle(vehicle)" - @keydown.enter="previewVehicle(vehicle)" + @keydown.enter="onVehicleSelect(vehicle)" tabindex="0" > @@ -117,9 +117,19 @@ export default defineComponent({ sorterDirection: 'asc' as SorterDirection, filterType: 'vehicles-all' as FilterType, + + lastScrollTop: 0, }; }, + deactivated() { + this.lastScrollTop = (this.$refs['vehicles'] as HTMLUListElement)?.scrollTop || 0; + }, + + activated() { + (this.$refs['vehicles'] as HTMLUListElement)?.scrollTo({ top: this.lastScrollTop }); + }, + watch: { computedVehicles() { const vehiclesRef = this.$refs['vehicles'] as HTMLElement; @@ -133,7 +143,8 @@ export default defineComponent({ methods: { isTractionUnit, - onItemSelect(vehicle: IVehicle) { + onVehicleSelect(vehicle: IVehicle) { + if (this.store.chosenVehicle?.type === vehicle.type) this.addVehicle(vehicle); this.previewVehicle(vehicle); },