-
Notifications
You must be signed in to change notification settings - Fork 365
Description
A similar if not same issue was fixed (#172) so not sure if this is duplicate or not. I am using latest version of the package (vis-timeline@8.3.0) and am running into an issue where the scrollbar jumps upwards when I remove a group from the timeline via timeline.setGroups(). For my timeline, I'd like the scrollbar to remain fully scrolled to the bottom of the timeline whenever a group is added/removed. As such, after adding a new item, I do this:
timeline.setGroups([...groups, newGroup]); // Adding a group
const scrollElement = document.querySelector('.vis-timeline .vis-panel.vis-left.vis-vertical-scroll');
if (scrollElement) scrollElement.scrollTop = scrollElement.scrollHeight;which works perfect. But when trying the same following removal of a timeline group, the scrollbar first flickers upwards before jumping back down to the bottom:
timeline.setGroups(groups.slice[0, -1]); // Removing a group
const scrollElement = document.querySelector('.vis-timeline .vis-panel.vis-left.vis-vertical-scroll');
if (scrollElement) scrollElement.scrollTop = scrollElement.scrollHeight;I've also tried setting a timeout on the scrollTop adjustment, but that didn't seem to change the behavior at all. Is there a way I can prevent the scrollbar from jumping whenever a group is removed so I can stop this flickering effect?