
Beyond the Phone: Split View, Foldables, Multi-Window
Window context is the third axis of responsive design — Split View, foldable devices, the visualViewport API, and Window Controls Overlay for PWAs.
TL;DR: Responsive design now has a third axis — window context. The same device can deliver, for example, a 1280px viewport on its own and a 400px viewport when sharing the screen with another app in Split View, and the change happens at runtime, not at device pickup. Size container queries (Baseline 2023) and ResizeObserver (Baseline 2020) replace viewport-width media queries because they react to actual rendered width instead of guessing from device class. The Visual Viewport API (Baseline 2021) reports the visible area after pinch-zoom, and after the on-screen keyboard appears in browsers that shrink the visual viewport for it (the default in current mobile Chrome and Safari), so sticky CTAs can be kept clear of the keyboard. Foldable devices and installed PWAs add geometry — env(viewport-segment-width 0 0) and env(titlebar-area-*) give the safe drawable region around hinges and OS window controls. A 768px tablet breakpoint hardcoded years ago is a common source of silent failures in these contexts.
The hidden third axis of responsive design
For the first decade of responsive design, viewport size was a proxy for the device. A 1280px viewport meant desktop. A 768px viewport meant tablet. A 360px viewport meant phone. Designers built three columns of breakpoints and treated the in-between values as "rare cases the design will still handle." That mental model was workable as long as the proxy held.
In 2026 it does not hold. The same Chromebook might deliver, for example, a 1280px viewport when Chrome owns the screen and a 480px viewport when the user splits the screen with the Files app. The same Galaxy Z Fold delivers a phone-class viewport when folded and a much wider one when open. The same iPad delivers a full-width viewport in Safari fullscreen and a much narrower viewport when Safari shares the screen with another app in a narrow split. An installed PWA with Window Controls Overlay enabled changes the drawable area without changing the viewport width — the title bar region is now part of the page.
These are not different devices; they are window contexts on the same device. They change at runtime, often within seconds of each other, and the change cannot be predicted from the user-agent string. The responsive surface has become a moving target, and the codebases that still hardcode breakpoints by device class are quietly accumulating layouts that work in the engineer's testing setup and fail in the user's actual one.
Browser split-screen contexts
The main split-view situations to plan for are predictable:
- iPadOS multitasking — Safari (or Chrome on iPad) side by side with another app, resized by dragging the divider, or, with windowed apps in iPadOS 26 and later, a browser window resized freely by dragging its corner. Either way the viewport width can change instantly while the user drags.
- ChromeOS multi-window — Chrome windows tiled side by side or arranged freeform. The visible viewport width depends on monitor size and tile layout, from narrow to very wide.
- Browser side panels — desktop Chrome and Edge can open a side panel (Chrome's reading list and bookmarks panel, Edge's sidebar with apps such as Copilot) beside the page, narrowing the page viewport without changing the window size.
- Android multi-window and Samsung DeX — particularly on Galaxy Z Fold and large tablets, multi-window use is a routine mode rather than an edge case.
In all these cases, window.resize events fire continuously during the drag gesture — as often as once per rendered frame. Handling layout reads inside those events without debouncing is a known source of jank during a split-view resize.
The cleanest defense is to stop reading window.innerWidth for layout decisions entirely. Size container queries (Baseline 2023) let components respond to their container's actual width — not the viewport. A card component that decides to switch from stacked to side-by-side at 25rem of container width works correctly whether it lives in a 1280px main column or a 400px sidebar, and whether the viewport is 1280px or 400px:
.card-list {
container-type: inline-size;
}
@container (min-width: 25rem) {
.card {
display: grid;
grid-template-columns: 6rem 1fr;
gap: 1rem;
}
}The same component now works in Split View without any extra code, because the query is against the container, not the window.
Foldable devices: Galaxy Fold, Surface Duo
Samsung's Galaxy Z Fold and Z Flip lines have gone through several generations, and Google (Pixel Fold) and OnePlus (Open) have shipped book-style foldables as well. Foldables are no longer exotic.
The Galaxy Z Fold opens from a phone-class outer screen to a near-square, tablet-class inner screen, and the viewport width jumps from phone class to something far wider the moment the user opens the device. The exact widths differ by generation, so check them on the device or on the Galaxy Z Fold preset in Chrome DevTools device mode rather than assuming. A device-class breakpoint has to guess which layout the unfolded screen gets: a site that treats any width past its tablet breakpoint as a landscape tablet can end up with a layout that is too cramped for the narrower, squarer inner display.
Dual-screen devices such as Microsoft's Surface Duo present a more challenging case: when the browser is spanned across both screens, the viewport covers two screens with a physical hinge in the middle. The Surface Duo line no longer receives updates — its last planned updates ended in September 2023, and in October 2024 for Surface Duo 2 — but the same geometry applies to any device whose viewport is split by a fold or hinge. A modal centered on the viewport sits across the hinge — visually broken. The viewport segment environment variables in CSS Environment Variables Level 1 and the horizontal-viewport-segments media feature in Media Queries Level 5 (W3C Working Drafts; shipped in Chromium-based browsers from version 138, not in Firefox or Safari, as of Nov 2026) expose the hinge geometry:
@media (horizontal-viewport-segments: 2) {
.layout {
display: grid;
grid-template-columns:
env(viewport-segment-width 0 0)
calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0))
env(viewport-segment-width 1 0);
}
}The middle track is the hinge: the gap between the right edge of the first segment and the left edge of the second.
The W3C Device Posture API (a Candidate Recommendation Draft as of Nov 2026) adds a device-posture media feature with two values: continuous (a flat position — the default for devices without folds or hinges) and folded (a device that physically folds, bent at an angle short of flat, such as a book or laptop posture, while the browser spans both sections). A folded device whose browser stays within one screen or section reports continuous. Together these let a layout split into two logical panes when the device reports two segments or a folded posture.
Browser support remains uneven as of Nov 2026. Treat viewport segments and device-posture as progressive enhancement: design the layout to work as a single-pane responsive layout first, then add the segmented variant for devices that support the query. The cost of skipping is a centered modal that sits across the hinge on visits from these devices where the browser spans the hinge; the cost of building it is a small CSS block that no other device sees.
visualViewport API for keyboard and zoom
The Visual Viewport API (Baseline 2021) is one that teams can end up discovering only after shipping a sticky CTA that the on-screen keyboard covers.
The distinction:
| API | What it describes |
|---|---|
| `window.innerWidth / innerHeight` | The layout viewport — does not change when the user pinch-zooms; by default in current mobile Chrome and Safari, also not when the keyboard appears (in Chrome on Android, `interactive-widget=resizes-content` changes this) |
| `window.visualViewport.width / height` | The visual viewport — shrinks when the user zooms in, and when the keyboard appears in browsers that resize the visual viewport for it (the default in current mobile Chrome and Safari) |
| `window.visualViewport.offsetTop / offsetLeft` | The offset of the visual viewport relative to the layout viewport |
When the on-screen keyboard appears in current mobile Chrome and Safari, the layout viewport by default stays at (for example) 800px tall. The visual viewport — the part the user can actually see — shrinks to maybe 400px tall, with an offsetTop of 0 and a height of 400. A sticky CTA positioned with bottom: 0 on the layout viewport can sit beneath the keyboard, hidden from the user filling out the form above it.
The fix:
function positionStickyAboveKeyboard() {
const vv = window.visualViewport;
if (!vv) return;
const offset = window.innerHeight - vv.height - vv.offsetTop;
document.documentElement.style
.setProperty('--keyboard-offset', `${offset}px`);
}
window.visualViewport?.addEventListener('resize', positionStickyAboveKeyboard);
window.visualViewport?.addEventListener('scroll', positionStickyAboveKeyboard);.sticky-cta {
position: fixed;
bottom: var(--keyboard-offset, 0px);
left: 0;
right: 0;
}When the user pinch-zooms, the same offset keeps the CTA's bottom edge at the bottom of the visible region. It does not correct for horizontal panning or the zoom scale, so keeping the CTA fully on screen while zoomed also needs offsetLeft and scale.
PWA: Window Controls Overlay
PWAs installed in desktop Chrome or Edge (version 105 and later, as of Nov 2026) can opt into Window Controls Overlay (WCO). The overlay appears only when the installed app runs in its own window on a desktop operating system, at the origin it was installed for. When enabled, the OS-level title bar is removed and the page's drawable region extends up to the top of the window — except for the areas kept for the window controls (minimize, maximize, close) and the browser's own menu button.
The opt-in is in the manifest:
{
"display": "standalone",
"display_override": ["window-controls-overlay"],
"name": "..."
}When the browser grants WCO, the page receives env(titlebar-area-*) CSS environment variables describing the safe drawable region:
.app-titlebar {
position: fixed;
top: env(titlebar-area-y, 0);
left: env(titlebar-area-x, 0);
width: env(titlebar-area-width, 100%);
height: env(titlebar-area-height, 40px);
-webkit-app-region: drag;
}env(titlebar-area-width) is the part of the top bar the page owns; the OS controls live outside it. On macOS the controls sit on the left, on Windows on the right, and other platforms can differ — the environment variables abstract the platform difference. A PWA titlebar that respects neither them nor navigator.windowControlsOverlay.getTitlebarAreaRect() will have part of its content hidden under the OS minimize/close buttons on one platform and look correct on the others.
Check whether WCO is active at runtime: navigator.windowControlsOverlay?.visible returns true when the user has installed the PWA and the browser is granting the overlay mode. Style the titlebar conditionally on that state — the same code should work both in-browser (no WCO) and installed (WCO active).
Detecting and responding at runtime
The pattern that scales across all the window contexts above is the same: stop reading window.innerWidth for layout decisions and react to component-local size changes through ResizeObserver (Baseline 2020; the contentBoxSize array used below is Baseline 2022).
const observer = new ResizeObserver((entries) => {
for (const entry of entries) {
const width = entry.contentBoxSize[0].inlineSize;
entry.target.classList.toggle('is-narrow', width < 400);
entry.target.classList.toggle('is-wide', width >= 800);
}
});
observer.observe(document.querySelector('.dashboard'));ResizeObserver fires when observation starts and when the observed element's size changes (including when the element is inserted into or removed from the DOM, or set to display: none) — not on every window resize event. It is the right primitive for component-level adaptation and pairs naturally with container queries in CSS: CSS handles layout reflow, JavaScript triggers state changes (loading different chart granularity, switching from a desktop dashboard layout to a mobile one) that the CSS cannot express.
Avoid polling window.innerWidth inside setInterval — it pre-dates ResizeObserver, adds recurring work to the main thread, and that work can compete with interaction handling. Testing setups for these contexts should include a locally installed copy of the PWA (to see standalone display and Window Controls Overlay as users do), Chrome DevTools device mode with its foldable presets (such as Galaxy Z Fold and Asus Zenbook Fold as of Nov 2026, switchable between continuous and folded postures), and an actual iPad running the browser side by side with another app.
Common failure modes and fixes
A short catalog of common silent failures in responsive sites and their fixes:
- Fixed sticky CTA covered by software keyboard on mobile → use
visualViewportresize/scroll events to position above the keyboard. - Layout assumes greater than 768px and breaks in a narrow side-by-side split → replace viewport-width media queries with container queries on the component container.
- Modal centered on a dual-screen device or a half-folded foldable sits across the hinge while the browser spans both screens or sections → add a
horizontal-viewport-segments: 2query to split the modal into two panes, or constrain modal width to one segment. - PWA top bar overlaps macOS traffic-light buttons or Windows close button → read
env(titlebar-area-x / width)and apply padding accordingly. Test on at least two desktop operating systems. - Site looks fine at the engineer's laptop but breaks for an iPad user with Safari in a narrow split → open browser developer tools, force the viewport to 400 CSS px, and walk through every primary task. This single test covers the narrow-split failures above at once.
Phase 1 deliverables and acceptance criteria
The migration to multi-window-aware responsive design is incremental and the gains compound.
- Open browser developer tools, set the viewport to 400 CSS px, and walk every primary user task on the top three routes. Fix what breaks — this surfaces narrow-split layout bugs quickly.
- Replace
window.resizelisteners on layout-sensitive code with ResizeObserver on the relevant component container. - Test on iPad Safari with the site running in a narrow side-by-side split, where layouts built on device-class breakpoints tend to break silently.
- If you ship a PWA, review
display_overrideand applyenv(titlebar-area-*)padding for Window Controls Overlay. Test on macOS and Windows — the OS controls live on different sides. - If your analytics show foldable visitors among your target users, open the layout on a Galaxy Z Fold preset in Chrome DevTools device mode and confirm the unfolded inner screen does not trigger a layout designed for a 1024px tablet.
The third axis of responsive design — window context — is permanent. Container queries, ResizeObserver, and the Visual Viewport API handle size and window state, and the viewport segment variables, the device-posture media feature, and the title bar area variables cover foldable geometry and installed-PWA chrome, so a single codebase can respond to all four. The codebases that stay stuck on the 768px tablet breakpoint are not slower; they are accumulating a steady backlog of layouts that work in the engineer's testing setup and fail in the user's actual one.