@bobfrankston/rmfmail 1.2.41 → 1.2.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2811,6 +2811,7 @@ function currentViewKey() {
2811
2811
  function withScrollAnchor(body, doRender) {
2812
2812
  const scrollTop = body.scrollTop;
2813
2813
  const viewportH = body.clientHeight;
2814
+ const wasAtTop = scrollTop < 4;
2814
2815
  let anchorUuid = "";
2815
2816
  let anchorOffsetWithinViewport = 0;
2816
2817
  const selected = body.querySelector(".ml-row.selected");
@@ -2841,7 +2842,11 @@ function withScrollAnchor(body, doRender) {
2841
2842
  return;
2842
2843
  const after = body.querySelector(`.ml-row[data-uuid="${CSS.escape(anchorUuid)}"]`);
2843
2844
  if (after) {
2844
- body.scrollTop = after.offsetTop - anchorOffsetWithinViewport;
2845
+ if (wasAtTop && after.offsetTop < viewportH - after.offsetHeight) {
2846
+ body.scrollTop = 0;
2847
+ } else {
2848
+ body.scrollTop = after.offsetTop - anchorOffsetWithinViewport;
2849
+ }
2845
2850
  }
2846
2851
  }
2847
2852
  function rememberPosition() {