Skip to content

Commit 9d67c67

Browse files
Remove inline scroll script - IT was causing the modal jump
Final debugging revealed the smoking gun: The inline script I added in the previous commit was CAUSING the jump, not fixing it. What was happening: 1. Modal opens with iframe loading Types.php 2. My inline script runs: window.scrollTo(0, 0) on DOMContentLoaded/load 3. This forced scroll INSIDE the iframe triggers layout recalculation 4. WordPress modal parent detects the change and jumps visually The Fix: REMOVE the inline script completely. Stop fighting the browser. Let the modal and iframe render naturally without forced scrolling. Removed: - All CSS attempting to prevent layout shift - All inline JavaScript scroll commands - window.scrollTo(0, 0) on DOMContentLoaded - window.scrollTo(0, 0) on load - scrollTop assignments The modal should now open smoothly without jumping. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 85b6213 commit 9d67c67

1 file changed

Lines changed: 0 additions & 19 deletions

File tree

classes/Visualizer/Render/Page/Types.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,6 @@ protected function _toHTML() {
5252
* @access protected
5353
*/
5454
protected function _renderContent() {
55-
// CSS to prevent layout shift - ensure page starts at top
56-
echo '<style>';
57-
echo 'html { scroll-behavior: auto !important; }';
58-
echo 'body { overflow-x: hidden; }';
59-
echo '#type-picker { min-height: 100vh; }';
60-
echo '</style>';
61-
62-
// Script to scroll to top AFTER content fully loads (fixes CSS layout shift)
63-
echo '<script>';
64-
echo 'document.addEventListener("DOMContentLoaded", function() {';
65-
echo ' window.scrollTo(0, 0);';
66-
echo ' document.documentElement.scrollTop = 0;';
67-
echo ' document.body.scrollTop = 0;';
68-
echo '});';
69-
echo 'window.addEventListener("load", function() {';
70-
echo ' window.scrollTo(0, 0);';
71-
echo '});';
72-
echo '</script>';
73-
7455
echo '<div id="type-picker">';
7556

7657
// AI Image Upload Section

0 commit comments

Comments
 (0)