Page MenuHomePhorge

No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None
diff --git a/src/components/scroll_top_button/scroll_top_button.js b/src/components/scroll_top_button/scroll_top_button.js
index e4b908f0b8..41340dbad0 100644
--- a/src/components/scroll_top_button/scroll_top_button.js
+++ b/src/components/scroll_top_button/scroll_top_button.js
@@ -1,18 +1,19 @@
const ScrollTopButton = {
props: {
fast: {
type: Boolean,
required: false,
default: false,
},
},
+ inject: ['bodyScrollPosition'],
methods: {
scrollToTop() {
const speed = this.fast ? 'instant' : 'smooth'
- window.scrollTo({ top: 0, behavior: speed })
+ this.bodyScrollPosition.scrollTo({ top: 0, behavior: speed })
},
},
}
export default ScrollTopButton
diff --git a/src/composables/useDocumentFocus.js b/src/composables/useDocumentFocus.js
index 8e31fea859..ae09327b06 100644
--- a/src/composables/useDocumentFocus.js
+++ b/src/composables/useDocumentFocus.js
@@ -1,35 +1,35 @@
import { nextTick, onMounted, onUnmounted, ref } from 'vue'
export function useDocumentFocus() {
- const focused = ref(false)
+ const focused = ref(!document.hidden)
const handleVisibilityChange = async () => {
focused.value = !document.hidden
}
onMounted(async () => {
if (document.hidden !== undefined) {
document.addEventListener(
'visibilitychange',
handleVisibilityChange,
false,
)
}
await nextTick()
})
onUnmounted(() => {
if (document.hidden !== undefined) {
document.removeEventListener(
'visibilitychange',
handleVisibilityChange,
false,
)
}
})
return {
focused,
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Oct 11, 1:31 AM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1785529
Default Alt Text
(1 KB)

Event Timeline