Commit 85b6213
Fix layout shift - The REAL root cause (remove all scroll-blocking)
Based on AI debugging analysis, the issue was NOT JavaScript scroll:
- NO scroll events were triggered
- NO JavaScript scroll calls happened
- NO autofocus was causing scroll
THE REAL ISSUE: CSS Layout Shift
What happens:
1. library.js:140 opens modal with view.open()
2. WordPress focuses modal container immediately
3. Modal iframe loads Types.php content
4. Content renders with "Create Chart from Image" at top
5. BUT viewport has already anchored to visible content
6. Result: Appears scrolled to "Select Library" section
THE FIX:
Removed:
- 51 lines of useless scroll-blocking JavaScript
- API overrides for window.scrollTo
- Element.prototype.scrollTop overrides
- All the "nuclear option" code that didn't work
Added:
- Simple CSS to prevent layout shift
- scroll-behavior: auto (disable smooth scroll)
- min-height: 100vh on #type-picker
- Simple scroll-to-top on DOMContentLoaded and load events
This addresses the ACTUAL problem: ensuring viewport stays at top
when iframe content finishes rendering, not blocking non-existent scrolls.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 20ff363 commit 85b6213
1 file changed
Lines changed: 21 additions & 53 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
55 | 74 | | |
56 | 75 | | |
57 | 76 | | |
| |||
169 | 188 | | |
170 | 189 | | |
171 | 190 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | 191 | | |
224 | 192 | | |
225 | 193 | | |
| |||
262 | 230 | | |
263 | 231 | | |
264 | 232 | | |
265 | | - | |
266 | | - | |
| 233 | + | |
| 234 | + | |
267 | 235 | | |
268 | 236 | | |
269 | 237 | | |
| |||
0 commit comments