Skip to content

Commit

Permalink
fix: fine-tune autoscroll behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Sendler committed Sep 4, 2024
1 parent 08d750d commit be28cbc
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1196,15 +1196,15 @@

const scrollToClickedElement = function scrollToClickedElement(data) {
if (data.status === 'success') {
document.getElementById(data.source.id).scrollIntoView({block: 'center', inline: 'nearest'});
document.getElementById(data.source.id).scrollIntoView({block: 'nearest', inline: 'nearest'});
}
};

const scrollToCurrentNode = function scrollToCurrentNode(data) {
if (data.status === 'success') {
const currentNode = document.querySelector('.current-node');
if (currentNode) {
currentNode.scrollIntoView({block: 'center', inline: 'center'});
currentNode.scrollIntoView({block: 'nearest', inline: 'center'});
}
}
};
Expand Down

0 comments on commit be28cbc

Please sign in to comment.