With major companies such as Huawei and Samsung already having unveiled foldable devices, it seems inevitable that even more will follow suit, potentially signaling a significant change in the future for smartphone designs. However, it hasn't been an easy road for the emerging class of devices so far by any means.

Microsoft is now looking to address some of the problems that arise with this form factor. In particular, the tech giant's Edge team has proposed a new API that aims to help developers improve web experiences for multi-display foldable devices (via Windows Latest).

Problems that will be targeted through this proposal have been highlighted as follows:

Hardware differences : Devices could be seamless (e.g. Samsung Galaxy Fold) or have a seam (ZTE Axon M), in the latter case developers might want to take it into account or intentionally ignore depending on scenario;

: Devices could be seamless (e.g. Samsung Galaxy Fold) or have a seam (ZTE Axon M), in the latter case developers might want to take it into account or intentionally ignore depending on scenario; Folding capabilities, state : the fold area could be safe or unsafe region to present content;

: the fold area could be safe or unsafe region to present content; Software occlusion : Parts of the individual window segments could be occluded by software keyboard, notifications or other transient pieces of UI, permanently or temporarily. Application might decide to react or ignore depending on the current content and occlusion area;

: Parts of the individual window segments could be occluded by software keyboard, notifications or other transient pieces of UI, permanently or temporarily. Application might decide to react or ignore depending on the current content and occlusion area; Future-proofing: Ideally developers would want a somewhat stable way to target this class of devices that won't require updates for every new device.

Named "Window Segments Enumeration", the API would allow for the use of Window Segments that represent the regions of a single window residing on different displays, such as for an application. Their dimensions would be represented in the form of CSS pixels and exposed through a JavaScript API, enabling developers to enumerate segments.

Its usage would be relevant to reactive scenarios, in which the application itself takes advantage of the multiple displays available, as opposed to proactive placement of content. Microsoft has also described how the current implementation would differ from the already existing Screen Enumeration API:

Note that given the Screen Enumeration API and existing primitives on the Web, it is possible to write JavaScript code that intersects the rectangles of the Display and window, while taking into account devicePixelRatio in order to compute the interesting layout regions of a window spanned across displays. However this may not correctly handle corner cases of future device form factors, and thus this proposal tries to centralize access to "here are the interesting parts of the screen a developer can target or consider for presenting content" as a practical starting point.

One use case in which this could be leveraged is, a map application with one window segment showcasing the map, while the other would be displaying results. Another implementation, one that could work with a mailing app, is a list of emails appearing in one segment, and selected emails appearing in the other. A software keyboard that emerges in either of these regions could be occluded in appearance.

Microsoft has also noted that this API doesn't come as a replacement for the already existing ones applicable to this problems space, and it offers no additional life-cycle proposals or suggestions regarding positioning of window segments. Even so, its implementation can prove to be quite useful in certain scenarios. We might even see some form of it appear in the tech giant's rumored foldable device expected to launch next year. You can read more about the API from its GitHub documentation.