Skip to content

Commit

Permalink
Use window.visualViewport for window size for scrolling
Browse files Browse the repository at this point in the history
FIX: Fix an issue where some commands didn't properly scroll the cursor into
view on Mobile Safari.
  • Loading branch information
marijnh committed Mar 11, 2024
1 parent 4c8fff5 commit 1c0a088
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ export function flattenRect(rect: Rect, left: boolean) {
}

function windowRect(win: Window): Rect {
let vp = win.visualViewport
if (vp) return {
left: 0, right: vp.width,
top: 0, bottom: vp.height
}
return {left: 0, right: win.innerWidth,
top: 0, bottom: win.innerHeight}
}
Expand Down

0 comments on commit 1c0a088

Please sign in to comment.