Skip to content

Allow for emulation of safe area insets #1054

@sadym-chromium

Description

@sadym-chromium

Partly addressing #772

Modern mobile devices frequently feature physical screen obstructions such as "the notch," camera cutouts (hole-punch displays), and software-defined system overlays (e.g., home indicators and status bars). To ensure web content remains usable on these devices, web developers rely on CSS environment variables—specifically env(safe-area-inset-*) to dynamically adjust their layouts.

Currently, WebDriver BiDi does not provide a mechanism to control these values, making it impossible for automated tests to verify "mobile-ready" layouts in an emulated environment.

Scenarios

  • Mobile Device Emulation: Users must be able to simulate specific hardware profiles (e.g., an iPhone 15 or a Samsung Galaxy S24) where the safe area insets are pre-configured to match the physical properties of those devices.
  • Content Visibility Testing: Users must be able to verify that critical UI elements (like fixed-position headers or "floating action buttons") are not obscured by a hardware cutout or system navigation bar.
  • Dynamic Layout Reflow: Users must be able to test how a responsive site handles the repositioning of safe zones ensuring that content "safe zones" are respected without requiring a page reload (e.g., simulating the transition of a notch from the top to the side, or device orientation changes).
  • Edge-to-Edge Experience: Enabling tests to verify that viewport-fit: cover behavior correctly expands content into the non-safe areas while maintaining readable margins via the environment variables.

Proposed Solution

We propose adding a new command browsingContext.setSafeAreaInsets

browsingContext.setSafeAreaInsets = {
  top: uint,
  right: uint,
  bottom: uint,
  left: uint,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions