Browse Source

refactor: Stop scrolling to top of page on modal open

Owen Diffey 2 years ago
parent
commit
6fed402151
1 changed files with 1 additions and 19 deletions
  1. 1 19
      frontend/src/App.vue

+ 1 - 19
frontend/src/App.vue

@@ -1,6 +1,6 @@
 <script setup lang="ts">
 import { useRouter } from "vue-router";
-import { defineAsyncComponent, ref, computed, watch, onMounted } from "vue";
+import { defineAsyncComponent, ref, watch, onMounted } from "vue";
 import Toast from "toasters";
 import { storeToRefs } from "pinia";
 import { GenericResponse } from "@musare_types/actions/GenericActions";
@@ -34,8 +34,6 @@ const modalsStore = useModalsStore();
 const apiDomain = ref("");
 const socketConnected = ref(true);
 const keyIsDown = ref("");
-const scrollPosition = ref({ y: 0, x: 0 });
-const aModalIsOpen2 = ref(false);
 const broadcastChannel = ref();
 const christmas = ref(false);
 const disconnectedMessage = ref();
@@ -52,8 +50,6 @@ const {
 const { activeModals } = storeToRefs(modalsStore);
 const { openModal, closeCurrentModal } = modalsStore;
 
-const aModalIsOpen = computed(() => Object.keys(activeModals.value).length > 0);
-
 const toggleNightMode = () => {
 	if (loggedIn.value) {
 		socket.dispatch(
@@ -95,20 +91,6 @@ watch(activityWatch, enabled => {
 	if (enabled) aw.enable();
 	else aw.disable();
 });
-watch(aModalIsOpen, isOpen => {
-	if (isOpen) {
-		scrollPosition.value = {
-			x: window.scrollX,
-			y: window.scrollY
-		};
-		aModalIsOpen2.value = true;
-	} else {
-		aModalIsOpen2.value = false;
-		setTimeout(() => {
-			window.scrollTo(scrollPosition.value.x, scrollPosition.value.y);
-		}, 10);
-	}
-});
 
 onMounted(async () => {
 	window