Skip to content

A platform for community discussion. Free, open, simple.

FIX: weird slow auto scrolling on iOS (#29598)

Régis Hanolafdca41fd517
diff --git a/app/assets/javascripts/discourse/app/components/d-virtual-height.gjs b/app/assets/javascripts/discourse/app/components/d-virtual-height.gjs
index 4c88f270c87..4ab506df947 100644
--- a/app/assets/javascripts/discourse/app/components/d-virtual-height.gjs
+++ b/app/assets/javascripts/discourse/app/components/d-virtual-height.gjs
@@ -75,13 +75,16 @@ export default class DVirtualHeight extends Component {
height = activeWindow?.height || window.innerHeight;
}
- const newVh = height * 0.01;
- if (this.lastVh === newVh) {
+ if (this.previousHeight && Math.abs(this.previousHeight - height) <= 1) {
return;
}
- document.documentElement.style.setProperty("--composer-vh", `${newVh}px`);
- this.lastVh = newVh;
+ this.previousHeight = height;
+
+ document.documentElement.style.setProperty(
+ "--composer-vh",
+ `${height / 100}px`
+ );
}
@bind