Frontmatter
| id | 9050 |
| title | Perf: Optimize DomAccess.syncAligns to avoid scroll thrashing |
| state | Closed |
| labels | aiperformancecore |
| assignees | tobiu |
| createdAt | Feb 8, 2026, 5:27 PM |
| updatedAt | Feb 8, 2026, 5:29 PM |
| githubUrl | https://github.com/neomjs/neo/issues/9050 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Feb 8, 2026, 5:29 PM |
Perf: Optimize DomAccess.syncAligns to avoid scroll thrashing

tobiu
Feb 8, 2026, 5:29 PM
Input from Gemini 3 Pro:
✦ I have implemented the optimization in
src/main/DomAccess.mjs.The
syncAlignsmethod now checks if the event type isscroll. If it is, and the target is not the document/window, it verifies if the scroll target contains either thealign.targetElementor thealign.constrainToElement.If the scroll target is unrelated (e.g., scrolling inside the picker's own content), the re-alignment logic is skipped. This effectively stops the layout thrashing loop.
Merged in commit
d79dbae23.
tobiu assigned to @tobiu on Feb 8, 2026, 5:29 PM
tobiu closed this issue on Feb 8, 2026, 5:29 PM
Neo.main.DomAccess.syncAlignstriggers 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
syncAlignsto 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:
syncAlignsinsrc/main/DomAccess.mjs.scroll.event.targetcontains thealign.targetElementoralign.constrainToElement.align().This will prevent unnecessary calculations and DOM read/writes during scrolling interactions within floating components.