Skip to content

fix(scroll lock, modal): leave revealing the focused field above the iOS keyboard to Safari - #729

Merged
blvdmitry merged 1 commit into
mainfrom
claude/cool-franklin-7rh535
Nov 22, 2026
Merged

blvdmitry merged 1 commit into
mainfrom
claude/cool-franklin-7rh535

Conversation

@blvdmitry

Copy link
Copy Markdown
Contributor

Summary

Removes the custom on-screen keyboard handling added in #720, #723 and #727. It raced Safari's own panning, so focusing fields in a modal moved the content around: the modal top got cut off, a gap opened above the keyboard, and the page jumped back.

This follows Base UI's default useScrollLock. On iOS, and with overlay scrollbars, it only sets overflow on the viewport scroller. Its comment explains the choice: fields must still scroll into view natively, and the toolbar must not force itself into view.

  • Scroll lock on iOS (lockSafari.ts): back to overflow only. scroll/keyboardPan.ts (preventKeyboardPan) and its tests are deleted. That module focused pressed fields with a geometry override, put a panned page back and revealed fields inside their own scroll container.
  • Modal: no longer ends above the keyboard. --rs-modal-keyboard and --rs-modal-keyboard-height are gone, and so is the bottom safe area reduced by the keyboard. The modal CSS is back to its state before feat: useVirtualKeyboard hook, Modal bottom safe area under the keyboard #720, apart from the unrelated swipe and sheet changes made since.
  • useVirtualKeyboard stays public, for apps that position their own content above the keyboard (Untap's action bar does).

The Modal browser test now checks that the modal stays in place when the visual viewport shrinks for the keyboard.

Changesets

modal-keyboard-inset, modal-keyboard-safe-area and scroll-lock-keyboard-pan were only released in canaries. They are removed from .changeset/ and from pre.json, so the stable changelog doesn't describe behavior that no longer exists. A new native-keyboard-reveal changeset tells canary users what changed.

Related Issue

Messy focus and panning in iOS Safari with a modal open (screen recording from Untap).

Screenshots / Recordings

None. The behavior only shows on an iOS device with the on-screen keyboard.

Notes for Reviewers

  • Tested locally: utilities src/scroll and src/viewport, browser tests for Modal, Overlay and hooks, Modal stories, tsc and pnpm lint.
  • Not yet checked on a real iPhone. Worth a pass on iOS Safari: a bottom sheet with fields, an end modal with a long form, and moving between fields with the keyboard arrows.
  • Untap's matching PR removes its own pan lock. It needs a Reshaped canary that includes this change.

Generated by Claude Code

…iOS keyboard to Safari

Page scroll lock on iOS goes back to overflow only, like Base UI's lock for overlay scrollbars:
it no longer focuses the pressed fields itself, reveals them in their scroll container or puts
back the page Safari panned. Modal no longer ends above the on-screen keyboard. Both raced
Safari's own panning, which left the modal content moving between the positions each resolved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKGZMmVFz6mwWJsnAQRqoY
@github-actions

Copy link
Copy Markdown

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Library / JS 53.96 KB (-1.32% 🔽) 1.1 s (-1.32% 🔽) 0 ms (+100% 🔺) 1.1 s
Library / CSS 24.83 KB (-0.22% 🔽) 497 ms (-0.22% 🔽) 0 ms (+100% 🔺) 497 ms
Theming / JS 7.8 KB (0%) 156 ms (0%) 187 ms (+78.03% 🔺) 343 ms
Theming with a default theme definition / JS 8.68 KB (0%) 174 ms (0%) 150 ms (+0.86% 🔺) 324 ms

@blvdmitry
blvdmitry merged commit e6fc413 into main Nov 22, 2026
11 checks passed
@blvdmitry
blvdmitry deleted the claude/cool-franklin-7rh535 branch November 22, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants