Changeset 2d596cf in Klonkt


Ignore:
Timestamp:
06/19/2026 12:14:21 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
859bace0
Parents:
f8e8f9e
Message:

fix(editor): catch async caret scroll on mobile Chrome (empty caret + formatting)

With an empty caret, mobile Chrome scrolls the caret into view
asynchronously, after the restore frames → the view still jumped.
keepScroll now watches every scroll event (capture) for 350 ms and
resets it to the user's position; free scrolling after that.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/post-edit.ejs

    rf8e8f9e r2d596cf  
    10981098    fn();
    10991099    restore();
    1100     requestAnimationFrame(restore);
    1101     requestAnimationFrame(function () { requestAnimationFrame(restore); });
     1100    // Mobiel Chrome scrollt de caret ASYNCHROON in beeld (ná meerdere frames), ook
     1101    // bij een lege caret. Vang élke scroll de eerstvolgende ~350 ms af en zet 'm
     1102    // terug; daarna mag de gebruiker weer vrij scrollen.
     1103    const onScroll = function () { restore(); };
     1104    window.addEventListener('scroll', onScroll, true);
     1105    setTimeout(function () { window.removeEventListener('scroll', onScroll, true); }, 350);
    11021106  }
    11031107  function execCmd(cmd, arg) {
Note: See TracChangeset for help on using the changeset viewer.