This document specifies an API that allows web applications to request and be notified of changes of the posture of a device.
The device posture is the physical position in which a device holds which may be derived from sensors in addition to the angle. New types of mobile devices are appearing that have some sort of capabilities that allow them to change their posture. The most common types of devices are the ones that can fold (their screen or around their screen), allowing them to physically alter their form factor. The main interest in knowing the posture of a device is to enable new user experiences with responsive design.
We propose a media query that would resolve to a set of fixed postures. These postures consist of a number of predefined values that each encompass a range of angles.
Among the values that the device-posture query can take are:
folded
(applies to laptop/book postures)folded-over
(applies to tent modes)continuous
(applies to flat, tablet, or even seamless curved displays)
/*using the device in a 'book' posture*/
@media (device-posture: folded) and (screen-spanning: single-fold-vertical) { ... }
/*using the device in a 'tent' posture*/
@media (device-posture: folded-over) { ... }
The Navigator property of Window navigator should host device capabilities and system states.
DevicePosture : EventTarget {
readonly attribute DevicePostureType type;
attribute EventHandler onchange;
}
enum DevicePostureType {
"folded",
“...”,
}
No stakeholder feedback has been given at this time.
Many thanks for valuable feedback and advice from: