mirror of
https://github.com/oobabooga/textgen.git
synced 2026-08-06 02:00:42 -05:00
Fix jittering while typing on Firefox (closes #7086)
This commit is contained in:
@@ -170,6 +170,13 @@ targetElement.addEventListener("scroll", function() {
|
||||
|
||||
// Create a MutationObserver instance
|
||||
const observer = new MutationObserver(function(mutations) {
|
||||
// Check if this is just the scrolling class being toggled
|
||||
const isScrollingClassOnly = mutations.every(mutation =>
|
||||
mutation.type === "attributes" &&
|
||||
mutation.attributeName === "class" &&
|
||||
mutation.target === targetElement
|
||||
);
|
||||
|
||||
if (targetElement.classList.contains("_generating")) {
|
||||
typing.parentNode.classList.add("visible-dots");
|
||||
document.getElementById("stop").style.display = "flex";
|
||||
@@ -182,7 +189,7 @@ const observer = new MutationObserver(function(mutations) {
|
||||
|
||||
doSyntaxHighlighting();
|
||||
|
||||
if (!window.isScrolled && targetElement.scrollTop !== targetElement.scrollHeight) {
|
||||
if (!window.isScrolled && !isScrollingClassOnly && targetElement.scrollTop !== targetElement.scrollHeight) {
|
||||
targetElement.scrollTop = targetElement.scrollHeight;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user