Case ce-0088-contenteditable-with-media-query · Scenario scenario-media-query-layout

Media query layout changes disrupt keyboard focus

OS: Android 13 Device: Phone Any Browser: Chrome Mobile 120.0 Keyboard: Mobile Samsung Status: confirmed
media-query layout mobile keyboard-dismiss

Phenomenon

When a CSS media query is triggered (e.g., rotating a device or shifting container width), browsers often trigger a layout pass that can invalidate the current DOM selection in mobile browsers, leading to the virtual keyboard being dismissed.

Reproduction Steps

  1. Open a contenteditable field on a mobile device.
  2. Focus the field so the virtual keyboard appears.
  3. Rotate the device (Portrait to Landscape).
  4. Observe that the keyboard often disappears.

Observed Behavior

The viewport change triggers a reflow that causes the browser to lose the active element focus if the element’s bounding box moves significantly.

Playground for this case

Use the reported environment as a reference and record what happens in your environment while interacting with the editable area.

Reported environment
OS: Android 13
Device: Phone Any
Browser: Chrome Mobile 120.0
Keyboard: Mobile Samsung
Your environment
Sample HTML:
Event log
Use this log together with the case description when filing or updating an issue.
0 events
Interact with the editable area to see events here.

Comments & Discussion

Have questions, suggestions, or want to share your experience? Join the discussion below.