Bug 273598 - VisionOS JS screen size API returns inconsistent values
Summary: VisionOS JS screen size API returns inconsistent values
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 17
Hardware: Vision Pro Other
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-05-01 17:39 PDT by odinman08
Modified: 2024-05-08 17:40 PDT (History)
7 users (show)

See Also:


Attachments
Shows Safari JS api sending 1306px × 735px screen size (102.23 KB, image/jpeg)
2024-05-01 17:39 PDT, odinman08
no flags Details
safari showing JS api for other screen size. (245.72 KB, image/jpeg)
2024-05-01 17:43 PDT, odinman08
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description odinman08 2024-05-01 17:39:55 PDT
Created attachment 471245 [details]
Shows Safari JS api sending 1306px × 735px screen size

using https://whatismyviewport.com I checked viewport size and screen size in Safari native VisionOS. 

On one try the screen size was 1306px × 735px. Looking at my site's analytics I could see that screen size for Intel Mac user agent started appearing Feb 2 when Apple Vision Pro launched.

When I reopened safari later the page reported 960px x 540px.

What should the expected resolution for screen size be on a device with not much of a logical "screen." Selfishly I'd like it to be something unique to have a way to track growth of Apple Vision Pro users to make web product decisions around
Comment 1 odinman08 2024-05-01 17:41:10 PDT
Oh, I guess I can't send the other screenshot showing it at the other resolution.
Comment 2 odinman08 2024-05-01 17:43:30 PDT
Created attachment 471246 [details]
safari showing JS api for other screen size.
Comment 3 Alexey Proskuryakov 2024-05-06 12:59:50 PDT
Windows can be resized by the user, so I'm not sure if this is a valid expectation. Even though there is no direct connection between visible window size and pixel dimensions, page rendering will change with the latter.
Comment 4 odinman08 2024-05-06 13:12:56 PDT
Alexey, 


Viewport width and height changes as a user adjusts their window size. I was not reporting an issue with Viewport API. That works as expected. As I change the window size in visionOS Safari, I see the API update values accordingly.

The screen width and height of a device normally doesn't change unless maybe the user changes the rendered resolution in system settings, right?

It's odd enough that the API would report 1306px × 735px as a screen size for a device that has screens the resolution of 4K TVs,let alone the fact that I'd be able to make the Safari window (and therefore the viewport) larger than the available screen size. Then even odder coming back to the Safari later would have it report out 960px x 540px. I don't know if there's some technical explanation I don't understand for how Apple Vision Pro is rendering everything in view or if it's just intentionally set this way.
Comment 5 Radar WebKit Bug Importer 2024-05-08 17:40:15 PDT
<rdar://problem/127776912>