0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-05-01 20:40:30 +00:00
nextcloud_server/core/src/public.ts
Christopher Ng 65ced2dd40 fix: Fix inaccessible content on public pages due to overlapping footer
Signed-off-by: Christopher Ng <chrng8@gmail.com>
2024-09-05 16:19:22 -07:00

26 lines
625 B
TypeScript

/**
* 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
})
}