Skip to content

Commit

Permalink
fix: scrolling can be incorrect when fast-forwarding
Browse files Browse the repository at this point in the history
  • Loading branch information
juliecheng committed Nov 9, 2023
1 parent 8aea5b0 commit e3fb1ea
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/rrdom/src/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@ function diffBeforeUpdatingChildren(
rrnodeMirror,
);
}
/**
* Edge case where `applyScroll` may fail in `diffAfterUpdatingChildren`:
* the height of a node when `applyScroll` is called may be incorrect if
* 1. its parent node contains styles that affects the targeted node's height
* 2. the CSS selector is targeting an attribute of the parent node
* by running `diffProps` on the parent node before `diffChildren` is called,
* we can ensure that the correct attributes (and therefore styles) have applied to parent nodes
*/
diffProps(oldElement, newRRElement, rrnodeMirror);
break;
}
}
Expand Down

0 comments on commit e3fb1ea

Please sign in to comment.