100% of unit tests pass in JSDOM while mobile dropdown fails in prod
JSDOM stubs layout geometry, passive touch listeners, and compositor hit-testing, masking real browser failures until tested in an actual engine.
Vitest/Jest JSDOM suite green; Safari/Chrome mobile throws Unable to preventDefault inside passive event listener or misses hit-testingCausal Chain of Browser Mechanisms
Ordered from trigger to root invariant. Open any mechanism to inspect its internals or reproduce the behavior in an interactive lab.
Cut layout thrashing and oversized DOM reflow costs—the Render Tree prunes display: none subtrees before Layout computes exact box geometry.
Eliminate 100ms+ mobile scroll-start jank—{ passive: true } promises the GPU compositor thread that wheel/touch listeners will never call preventDefault().
Green JSDOM tests ship broken layouts because Node.js DOM shims lack a layout engine, returning zeros for geometry and ignoring stacking contexts and CORS.
Real setTimeout calls in tests bake CI CPU jitter into assertions; fake timers replace wall-clock APIs with a deterministic queue that still breaks if microtasks are not drained.
CSS and data-testid selectors pass on clickable divs that screen readers and keyboards cannot reach; querying by computed ARIA role and accessible name tests the user-facing contract.