Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
webview js: Don't scroll on resize when *beyond* the bottom, either.
As the code comments (which we added in the last few commits) explain: when the viewport grows, we generally want to scroll up to keep its bottom edge aligned within the content, but we want to skip that when we're at the very bottom. If we're at the bottom and scroll up anyway, the effect would be exactly the symptoms in zulip#3301. It turns out that when we're at the bottom, the `scrollTop` value may not actually quite line up with where you'd think it should be. Empirically: * On iOS (in Safari), it tends to be 1px beyond the bottom. * On Android (in Chrome), it's not an integer, and can be a fraction of a px either beyond or short of the bottom. So, allow for that when checking to see if we're at the bottom. Thanks to Vishwesh for suggesting a related direction in zulip#4003. Fixes: zulip#3301
- Loading branch information