Jelajahi Sumber

fix: broken scroll to definition in graphql documentation

liyasthomas 3 tahun lalu
induk
melakukan
3614877964
1 mengubah file dengan 17 tambahan dan 4 penghapusan
  1. 17 4
      packages/hoppscotch-app/components/graphql/Sidebar.vue

+ 17 - 4
packages/hoppscotch-app/components/graphql/Sidebar.vue

@@ -410,12 +410,25 @@ const handleJumpToType = async (type: GraphQLType) => {
   await nextTick()
 
   const rootTypeName = resolveRootType(type).name
-
   const target = document.getElementById(`type_${rootTypeName}`)
   if (target) {
-    gqlTabs.value.$el
-      .querySelector(".gqlTabs")
-      .scrollTo({ top: target.offsetTop, behavior: "smooth" })
+    target.scrollIntoView({ block: "center", behavior: "smooth" })
+    target.classList.add(
+      "transition-all",
+      "ring-inset",
+      "ring-accentLight",
+      "ring-4"
+    )
+    setTimeout(
+      () =>
+        target.classList.remove(
+          "ring-inset",
+          "ring-accentLight",
+          "ring-4",
+          "transition-all"
+        ),
+      2000
+    )
   }
 }