cdp-dom-debugging
CDP DOM Debugging
The rule
When a geometry bug survives two plausible fixes, stop reading code and start measuring. Static analysis of effect timing and CSS cannot see what actually renders. Get runtime evidence via CDP before attempting fix #3.
Trap 1: getBoundingClientRect lies during animations/transforms
If any ancestor has an active CSS transform — entrance animations like
scale(.98) → 1, transitions, will-change — every rect distance is measured in
transformed space. Scroll math written from those rects lands systematically short
(e.g. true delta 12319px measured as 12076px under scale(0.98)), then the animation
completes, content expands back, and nothing re-corrects.
Symptoms: wrong on fresh mount, correct after unrelated re-renders (animation only restarts on mount); failure magnitude varies run to run; arithmetic off by a constant ratio ≈ the current scale factor.