Viewport Segments API

Open
#1,440 1 comment 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
css, javascript
Domain
api, frontend, web-dev

Research direction

Review the linked W3C specifications and the existing web-platform-tests at https://wpt.fyi/results/viewport/viewport-segments.html. Understand the CSS media queries, environment variables, and JavaScript API for viewport segments. The task likely involves creating or updating interoperability tests for this API, checking for correct behavior across different browser implementations. 'Done' means new or updated tests are added to the repository.

Written by the indexing model from the issue text.

Description

focus-area-proposal
Description

Foldable phones, tablets, and multi-posture laptops represent a growing segment of hardware. While the Device Posture API indicates how a device is held (e.g., folded vs continuous), developers need exact geometric segment boundaries to position columns, sidebars, and critical interface elements without content falling into a physical hinge or fold seam.

The latter is provided by the Viewport Segments API. It exposes the positions, dimensions, and count of logically separate viewport regions formed when a viewport is split across physical folds, hinges, or dual-screen displays. It provides both declarative CSS tools (@media (*-viewport-segments) and env(viewport-segment-* x y)) and imperative JavaScript properties (window.viewport.segments).

Spec links:

Specification

(See description, as there are several specs involved)

web-feature

viewport-segments

Test Links
Additional Signals

(This features goes hand-in-hand with the Device Posture API, but serves a different purpose)

Dominant language
JavaScript
Stars
591
Forks
39
Avg merge
3h 8m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from web-platform-tests/interop

All issues in web-platform-tests/interop

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.