Delay scroll restoration after card refresh
This commit is contained in:
1 parent
01fa2bc2b6
commit
e25899b3ee
1 file changed
+8
-3
@@ -28,17 +28,21 @@
|
||||
container,
|
||||
top: container.scrollTop,
|
||||
left: container.scrollLeft,
|
||||
scheduled: false,
|
||||
timer: null,
|
||||
});
|
||||
};
|
||||
|
||||
const restoreScrollPosition = (root) => {
|
||||
const state = scrollRestoreStates.get(root);
|
||||
if (!state || state.scheduled) {
|
||||
if (!state) {
|
||||
return;
|
||||
}
|
||||
|
||||
state.scheduled = true;
|
||||
if (state.timer) {
|
||||
window.clearTimeout(state.timer);
|
||||
}
|
||||
|
||||
state.timer = window.setTimeout(() => {
|
||||
requestAnimationFrame(() => {
|
||||
requestAnimationFrame(() => {
|
||||
if (state.container?.isConnected) {
|
||||
@@ -47,6 +51,7 @@
|
||||
scrollRestoreStates.delete(root);
|
||||
});
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
||||
const getDirectDeleteElement = (card, selector) => Array.from(card?.children || [])
|
||||
|
||||
Reference in new issue
Block a user