aboutsummaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2024-09-05 16:19:22 -0700
committerChristopher Ng <chrng8@gmail.com>2024-09-05 16:19:22 -0700
commit65ced2dd40412047a304de8d311e644ad91f5557 (patch)
treec2476008106fb3115bc05f386c9946332d0517a4 /core/src
parent9aafc0f989ea78e3536299da96861ea8a6c13f43 (diff)
downloadnextcloud-server-65ced2dd40412047a304de8d311e644ad91f5557.tar.gz
nextcloud-server-65ced2dd40412047a304de8d311e644ad91f5557.zip
fix: Fix inaccessible content on public pages due to overlapping footer
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'core/src')
-rw-r--r--core/src/public.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/core/src/public.ts b/core/src/public.ts
new file mode 100644
index 00000000000..ce4af8aa2ac
--- /dev/null
+++ b/core/src/public.ts
@@ -0,0 +1,26 @@
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+const body = document.body
+const footer = document.querySelector('footer')
+let prevHeight = footer?.offsetHeight
+
+const onResize: ResizeObserverCallback = (entries) => {
+ for (const entry of entries) {
+ const height = entry.contentRect.height
+ if (height === prevHeight) {
+ return
+ }
+ prevHeight = height
+ body.style.setProperty('--footer-height', `${height}px`)
+ }
+}
+
+if (footer) {
+ new ResizeObserver(onResize)
+ .observe(footer, {
+ box: 'border-box', // <footer> is border-box
+ })
+}