Explore Bato Web Agency Webflow Certified Partner Profile Explore Bato Web Agency Webflow Certified Partner Profile

How do you handle the on-screen keyboard with a sticky bottom action bar?

Illustration without a description Illustration without a description

An on-screen keyboard reduces the visual viewport, so a sticky or fixed bottom action bar may cover the focused field or sit behind the keyboard. The layout should protect the active input before preserving a permanently visible action bar. Native scrolling and scroll-margin often solve more cases than manual keyboard detection.

 

Keep form fields in normal document flow and add bottom padding equal to the action bar height. Give inputs scroll-margin-bottom so scrollIntoView() leaves room. Avoid wrapping the entire form in a fixed-height panel whose scroll area does not update when the keyboard opens.

 

.form-page {
padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
}

.form-page input,
.form-page textarea {
scroll-margin-bottom: 7rem;
}

 

For a bar that must react to the visible area, the Visual Viewport API reports height, offset and resize events. Use it as an enhancement because browser behavior differs. When the visible height drops sharply during focus, move or hide a nonessential bar. Do not infer keyboard state from one hard-coded pixel threshold.

 

Avoid continuous layout writes inside every viewport event. Schedule one update per animation frame and remove listeners when the component unmounts. Test pinch zoom because it also changes the visual viewport and should not be mistaken for keyboard opening. A user who zooms still needs access to the action and field.

 

Run the form on iOS Safari and Android Chrome with text, email, number and textarea inputs because keyboard layouts differ. Focus the last field, rotate the phone and advance with the keyboard’s Next button. The active field, validation message and submit action must remain reachable without trapping the page in an inner scroll area.