Android auto-scrolls to keep text visible
OS: Android 10-14 · Device: Mobile (Samsung, Pixel, etc.) Any · Browser: Chrome for Android 120+ · Keyboard: English (QWERTY) or Virtual Keyboard
Open case →Scenario
On iPhone/iPad Safari, when entering text or pressing "return" multiple times in a contenteditable element, the software keyboard appears but hides the text being typed. The page doesn't auto-scroll to keep text visible. Works fine on Android and other browsers.
On iPhone/iPad Safari, when entering text or pressing “return” multiple times in a contenteditable element, the software keyboard appears but hides the text being typed. The page doesn’t automatically scroll to keep the text insertion point visible.
This issue occurs when:
iOS Safari’s viewport and keyboard handling fails to:
Manually scroll to cursor on input:
editor.addEventListener('input', (e) => {
setTimeout(() => {
const selection = window.getSelection();
if (selection.rangeCount > 0) {
const range = selection.getRangeAt(0);
const rect = range.getBoundingClientRect();
// Scroll to keep caret visible
window.scrollTo({
top: rect.top + window.scrollY - 200, // 200px buffer
behavior: 'smooth'
});
}
}, 100);
});
Use resize observer on focus:
editor.addEventListener('focus', () => {
setTimeout(() => {
const selection = window.getSelection();
if (selection.rangeCount > 0) {
const range = selection.getRangeAt(0);
const rect = range.getBoundingClientRect();
// Ensure caret is visible
window.scrollTo({
top: rect.top + window.scrollY - 200,
behavior: 'smooth'
});
}
}, 300);
});
Set CSS viewport height:
/* May help with some iOS versions */
html, body {
height: 100vh;
overflow: auto;
}
Provide visual feedback: Show custom caret or typing indicator
// Create visual feedback since text might be hidden
const caret = document.createElement('span');
caret.className = 'ios-caret-indicator';
caret.style.cssText = `
position: absolute;
width: 2px;
height: 20px;
background: rgba(0, 120, 255, 0.5);
pointer-events: none;
`;
Visual view of how this scenario connects to its concrete cases and environments. Nodes can be dragged and clicked.
Each row is a concrete case for this scenario, with a dedicated document and playground.
| Case | OS | Device | Browser | Keyboard | Status |
|---|---|---|---|---|---|
| ce-0281-ios-keyboard-hides-text-android-en | Android 10-14 | Mobile (Samsung, Pixel, etc.) Any | Chrome for Android 120+ | English (QWERTY) or Virtual Keyboard | confirmed |
Open a case to see the detailed description and its dedicated playground.
OS: Android 10-14 · Device: Mobile (Samsung, Pixel, etc.) Any · Browser: Chrome for Android 120+ · Keyboard: English (QWERTY) or Virtual Keyboard
Open case →Other scenarios that share similar tags or category.
When a contenteditable element has CSS backdrop-filter applied, rendering may be affected. Text may appear blurry, selection may not render correctly, and performance may be degraded, especially on mobile devices.
On mobile devices, the combination of enterkeyhint and inputmode attributes may affect Enter key behavior inconsistently on contenteditable elements. The Enter key may insert line breaks when it should perform an action, or vice versa.
The `inputmode` attribute, which should control the type of virtual keyboard shown on mobile devices, does not work on contenteditable regions in iOS Safari. The keyboard type cannot be controlled.
On iOS Safari, when the software keyboard becomes visible, viewport calculations become unreliable. `position:fixed` elements break, `height` returns incorrect values, and absolute positioning with `top`/`bottom` fails. This severely affects editors with floating toolbars or positioned elements.
When a page with a contenteditable element responds to media query changes (e.g., orientation change, window resize), the layout changes may disrupt editing. The caret position may jump, and selection may be lost.
Have questions, suggestions, or want to share your experience? Join the discussion below.