Repository navigation
[drawer] Avoid excess keyboard spacing in Chrome on iOS - #5774
Merged
Merged
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,119.43 ms -22.76 ms(-2.0%) | Renders: 76 (+0) | Paint: 1,877.07 ms -16.83 ms(-0.9%) No significant changes — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
atomiks
marked this pull request as ready for review
September 23, 2026 05:38
atomiks
requested review from
colmtuite,
flaviendelangle,
jjenzz and
michaldudak
as code owners
September 23, 2026 05:38
zernonia
added a commit
to unovue/reka-ui
that referenced
this pull request
Sep 28, 2026
Port the latest Base UI `DrawerVirtualKeyboardProvider` changes: - Remove the extra keyboard scroll slack; pad by the overlap on top of at least the visibility margin (mui/base-ui#5768). - Reapply `preventScroll` on native focus before `focusin` for iOS 27, and after a tapped label refocuses its control (mui/base-ui#5769). - Track the keyboard across Chrome on iOS resizing the layout viewport, with an `svh` probe, a `resizing` guard and a window resize listener (mui/base-ui#5774). - Find the scroll container across shadow roots (mui/base-ui#5360). Also check for DrawerViewport once DrawerContent mounts, like Base UI's popup, so a drawer that starts open no longer logs a false warning. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
zernonia
added a commit
to unovue/reka-ui
that referenced
this pull request
Sep 28, 2026
#2889) * feat(Drawer): add DrawerVirtualKeyboardProvider for software keyboards The software keyboard slides over the bottom of the viewport without resizing it, so a bottom-anchored drawer — and the field the user just tapped — end up underneath it (#2877). Wrapping the drawer in `DrawerVirtualKeyboardProvider` opts into keyboard-aware focus and scroll handling: while a field inside the drawer is focused it publishes the keyboard height as `--drawer-keyboard-inset` on `DrawerViewport` (or the popup, when no viewport is used) and keeps the field scrolled into the band left visible above the keyboard, adding temporary slack to its scroller when the field would otherwise sit below the scrollable range. It also defends against WebKit: a tap on a field is focused synchronously with the field's painted geometry overridden so the native reveal cannot drag a transformed sheet, native focus moves are preempted the same way, and a modal drawer pins the page against reveal scrolls the scroll lock cannot hold. Alignment is suspended while pinch-zoomed or while a nested drawer is open, and viewport changes under 60px are treated as browser chrome rather than the keyboard. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * refactor(Drawer): pass view on the redispatched keyboard tap click Matches Base UI, falling back to an init without `view` where the window fails the realm check (jsdom). Restores lean Base UI references in the ported code. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * refactor(Drawer): require DrawerViewport for the virtual keyboard provider Matches Base UI: the viewport wraps the popup, acts as the measurement and containment root, and hosts `--drawer-keyboard-inset` for the popup and everything inside it. Warns in development when it is missing instead of falling back to the popup. * fix(Drawer): address review feedback on the virtual keyboard provider - `DrawerViewport` now remembers the element it registered on the root context. Vue nulls the template ref before `onUnmounted` runs, so the identity check against `currentElement` never matched and the root kept a detached viewport. - `useDrawerVirtualKeyboard` resolves `getComputedStyle` / `matchMedia` from the element's own window, like the rest of the composable. - Tests restore fake timers, `innerHeight`, `scrollTo`, `scrollY` and `elementFromPoint` in `afterEach` so cases stay order-independent, and a new case covers the viewport teardown. * test(Drawer): restore the original innerHeight descriptor after keyboard tests jsdom defines `window.innerHeight` as an own property, so deleting it in teardown left the window without one. Capture the descriptor before stubbing and put it back. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(Drawer): sync the virtual keyboard provider with upstream Base UI Port the latest Base UI `DrawerVirtualKeyboardProvider` changes: - Remove the extra keyboard scroll slack; pad by the overlap on top of at least the visibility margin (mui/base-ui#5768). - Reapply `preventScroll` on native focus before `focusin` for iOS 27, and after a tapped label refocuses its control (mui/base-ui#5769). - Track the keyboard across Chrome on iOS resizing the layout viewport, with an `svh` probe, a `resizing` guard and a window resize listener (mui/base-ui#5774). - Find the scroll container across shadow roots (mui/base-ui#5360). Also check for DrawerViewport once DrawerContent mounts, like Base UI's popup, so a drawer that starts open no longer logs a false warning.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5766.
Chrome's new iOS UI reports the keyboard's final visual viewport height first, then shrinks the layout viewport over the keyboard animation, moving fixed content itself. The provider measured the overlap once and applied it as an inset and scroll slack, leaving a large gap above the keyboard.
This PR detects that mode from
100svh, which Chrome shrinks for the keyboard at the first event (Safari leaves it alone), and applies no inset or slack there, so the drawer rides the browser's own layout. It also re-measures onwindowresize, and remembers the keyboard's visual height so focused fields are still centered and taps on the focused field keep native caret placement once the overlap is gone.Note: In Chrome, the alignment scroll now waits until the layout viewport has resized to the visual viewport, so it starts once the keyboard animation finishes (~300ms), which is less than ideal but could not find a proper solution that doesn't fight the animation. Previously it scrolled at the first event against a layout that was about to change - that's quicker, but the target was often wrong and needed correcting, and scrolls issued mid-resize were restarted by WebKit, which showed as jitter.