[drawer] Fix virtual software keyboard behavior#4353
Open
atomiks wants to merge 13 commits intomui:masterfrom
Open
[drawer] Fix virtual software keyboard behavior#4353atomiks wants to merge 13 commits intomui:masterfrom
atomiks wants to merge 13 commits intomui:masterfrom
Conversation
commit: |
Bundle size report
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. |
5c43db4 to
edc2dcb
Compare
0b731d7 to
3c56a00
Compare
7a59a04 to
3324955
Compare
86a0494 to
6fa3d9e
Compare
Bundle size
PerformanceTotal duration: 1,138.35 ms ▼-255.79 ms(-18.3%) | Renders: 53 (+0) | Paint: 1,750.77 ms ▼-405.14 ms(-18.8%)
...and 7 more. View full report Check out the code infra dashboard for more information about this PR. |
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.

Fixes #4301
https://deploy-preview-4353--base-ui.netlify.app/react/components/drawer#virtual-keyboard-aware
This adds an opt-in
Drawer.VirtualKeyboardProviderfor bottom-sheet drawers with form controls. The goal is to stop the browser's native keyboard scroll/focus behavior from pushing the sheet off-screen, while keeping the drawer scrollable and the focused field visible on iOS and Android touch devices.The provider does not restyle existing drawers by itself. To opt in fully, the popup styles need to consume the CSS variables that Base UI provides when the drawer is wrapped in
Drawer.VirtualKeyboardProvider.Because the behavior now lives behind a separate provider, the virtual-keyboard runtime can tree-shake out of drawers that do not import or use it.
Changes
Drawer.VirtualKeyboardProviderto enable keyboard-aware touch focus handling and visible-viewport tracking.--available-heightso popup styles can size against the reduced visual viewport instead of100vh.--drawer-keyboard-insetso bottom sheets can translate upward when the software keyboard overlaps the viewport.Drawer.VirtualKeyboardProvider.Styling notes
Drawer.VirtualKeyboardProvider, typically aroundDrawer.Portal,Drawer.Viewport, andDrawer.Popup.max-height: calc(var(--available-height, 100dvh) - <top gap> + <bleed>)onDrawer.Popupinstead of sizing only from100vh.translate: 0 calc(0px - var(--drawer-keyboard-inset, 0px)), while keeping swipe motion ontransform.