mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-05-06 21:42:30 +02:00
fix: Improve viewport fix to avoid interfering with page initialization
Changed viewport fix approach to be less invasive: - Removed document.body.style.height modification - Use document.documentElement.offsetHeight instead - Trigger resize event instead of modifying DOM - Increased delay from 100ms to 150ms for better stability This should prevent potential conflicts with channel loading and other page initialization code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -266,13 +266,14 @@
|
||||
<script>
|
||||
// Fix viewport corruption on Android PWA after page reload
|
||||
window.addEventListener('load', function() {
|
||||
// Force viewport recalculation
|
||||
// Force viewport recalculation without modifying body height
|
||||
setTimeout(() => {
|
||||
window.scrollTo(0, 0);
|
||||
// Force reflow
|
||||
document.body.style.height = '100%';
|
||||
void(document.body.offsetHeight);
|
||||
}, 100);
|
||||
// Force reflow using a less invasive method
|
||||
void(document.documentElement.offsetHeight);
|
||||
// Trigger resize event to recalculate layout
|
||||
window.dispatchEvent(new Event('resize'));
|
||||
}, 150);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user