-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix inaccessible content on public pages due to overlapping footer
Signed-off-by: Christopher Ng <[email protected]>
- Loading branch information
Showing
4 changed files
with
33 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters