Closed lauramorinigo closed 8 months ago
I believe that foldable should implement the Window Segment API because I believe the two are complimentary.
For example in the folded state, we would return two segments and thanks to the API you would know where the fold is. The implementation would be straightforward when the browser window is full screen, slightly more tricky in the case you mentioned (popup window). And the API let you do get the information with CSS.
All in all exposing the fold position is somewhat duplicating the information that the Window Segment API/CSS Media Spanning is providing. I think the only thing we would add over there is exposing the type of hinge (transparent vs non-transparent).
https://docs.microsoft.com/en-us/dual-screen/web/css-media-spanning
@kenchris @diekus what do you think?
I was working on a demo this past few days and I was trying to make it work on the Z Fold. Turns out that I hit the same issue you described here. In my case the demo make sense to use a split UX when the device has enough screen estate. In the Z fold it means the device is folded and used in landscape-primary. On the X1 Fold it means that the device is used in portrait-primary. At this point without the segments so I could derive the physical location of the fold I can't easily make the decision to enable the split UX or not.
So @lauramorinigo does Samsung has any plan to implement the viewport segments APIs on the Z Fold? Just like Microsoft is doing on the Duo.
@darktears thanks for this input, we definitely want to support viewport segments as this API is complimentary to device-posture. We've also figured out that orientation media queries are not enough for developers to make decisions properly regarding the layout. Anyway I'm trying to confirm if viewport-segment is supported on seamless devices too so we can have a better ETA about the implementation, do you have any information about this? (I've personally tested on edge and the developers tools with Surface Duo Emulator) cc @diekus
As of Edge 97 Viewport Segments is enabled by default. Viewport Segments on seamless device should return one segment and I can see that the API is working successfully on my Surface Duo (2 segments).
Viewport Segments is now implemented on foldables on Android and Windows (behind a developer flag on Chromium as of 03/2024).
There are some case scenarios where posture depends on the device orientation. For example, if a device is with the posture "laptop" then the browser doesn't identify/support the same way if it's portrait or landscape. In order to identify the posture, developers should check the device model or rely on media queries. Another case scenario is when browsers have multiwindow or popup mode, therefore the fold position will not always be the center of the screen but the posture is still relevant, same thing would apply for devices with more than one fold. Should the spec add a fold position to prevent this or just rely on media queries?