perf(PageLayout): Optimize drag/resize for large DOMs via inline styles and containment #7371
+0
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactors PageLayout performance optimizations to use inline styles instead of CSS attribute selectors, eliminating O(n) descendant traversal on every style recalc. Adds content-visibility, contain-intrinsic-size, rAF throttling, and instant drag handle feedback.
Before: Drag on 100k node DOM: 5-15 fps, 800-1200ms INP, visible jank
After: 50-60 fps, 200-300ms INP, minimal jank
Changelog
Changed
contain,pointer-events,content-visibilitydirectly to elements instead of via[data-dragging]CSS selectors. Eliminates descendant matching cost (O(n) → O(1))--draggable-handle--transitionvariablegetComputedStyle()when crossing 1280px breakpoint where--pane-max-width-diffchangessetContainmentOptimizations(),setDraggingStyles()New
content-visibility: auto- Skip rendering off-screen content in large DOMscontain-intrinsic-size: auto 500px- Prevent layout thrashing from size estimationPerformance Impact
Key wins: Selector matching O(n)→O(1), hit testing skipped on 100k nodes, off-screen rendering skipped, frame coalescing, instant visual feedback, smart resize queries
Rollout strategy
Testing & Reviewing
Tested with synthetic large DOMs in PageLayout performance stories. Verified with Chrome DevTools Performance profiler.
Merge checklist
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.