-
-
Notifications
You must be signed in to change notification settings - Fork 202
Perf: Optimize DomAccess.syncAligns to avoid scroll thrashing #9050
Copy link
Copy link
Closed
Labels
aicoreCore framework functionalityCore framework functionalityperformancePerformance improvements and optimizationsPerformance improvements and optimizations
Description
Neo.main.DomAccess.syncAligns triggers a full realignment cycle on every scroll event. This can cause significant layout thrashing (performance "hammering"), especially when scrolling inside a floating container (like a Picker's list) that is itself aligned to another element.
Goal:
Optimize syncAligns to filter scroll events. It should only trigger re-alignment if the scrolling element is an ancestor of the alignment target or the constraint element. If the scroll event originates from within the aligned component itself (or an unrelated container), the alignment logic should be skipped.
Implementation Plan:
- Modify
syncAlignsinsrc/main/DomAccess.mjs. - Check if the event type is
scroll. - If it is, verify if the
event.targetcontains thealign.targetElementoralign.constrainToElement. - If neither is contained, return early and skip
align().
This will prevent unnecessary calculations and DOM read/writes during scrolling interactions within floating components.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
aicoreCore framework functionalityCore framework functionalityperformancePerformance improvements and optimizationsPerformance improvements and optimizations