Update orientation state (window.screen.orientation) in Responsive Design Mode

RESOLVED FIXED in Firefox 69

Status

defect
P1
normal
RESOLVED FIXED
2 years ago
28 days ago

People

(Reporter: mail.eraserhead, Assigned: mtigley)

Tracking

(Blocks 2 bugs)

52 Branch
Firefox 69
Dependency tree / graph

Firefox Tracking Flags

(firefox69 fixed)

Details

(Whiteboard: [rdm-mvp] [dt-q])

Attachments

(2 attachments)

Reporter

Description

2 years ago
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20170323105023

Steps to reproduce:

Tested a responsive site in Responsive Design Mode that lazyloads images in portrait or landscape format depending on the device orientation.



Actual results:

I found out that window.orientation remains undefined.


Expected results:

window.orientation should be set according to the emulated device being in portrait or landscape mode.

Updated

2 years ago
Component: Untriaged → Developer Tools: Responsive Design Mode
I think the API you are looking for is `window.screen.orientation`?  If so, it's not `undefined`, but it is true that it remains set to `{ type: "landscape-primary", angle: 0, onchange: null }` even after you rotate.

Seems like a good feature request, thanks for filing!
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Summary: window.orientation for emulated devices in Responsive Design Mode → Update orientation state in Responsive Design Mode
Whiteboard: [rdm-v2]
Reporter

Comment 2

2 years ago
>Seems like a good feature request, thanks for filing!
Glad you think so, too.

>I think the API you are looking for is `window.screen.orientation`?
To my knowledge all mobile browsers (including mobile Firefox) support "window.orientation", but Safari for iOS does not support the "window.screen.orientation" object (while mobile Chrome does).
Reporter

Comment 3

2 years ago
P.S.
Not that it matters much, but mobile IE also only supports "window.orientation" - I just checked.
Reporter

Comment 4

2 years ago
P.P.S.
Interesting: On a Surface 3 Pro the only Browser to correctly indicate the screen orientation is Chrome - but only through the "window.screen.orientation" object. Firefox always reports angle 0, Edge knows nothing ;)
So no desktop browser supports "window.orientation" but all mobile browsers do.
Seems to me with the increase of tablet/convertible PCs it would make sense to have that information available on desktop browsers, too.

Updated

Last year
Product: Firefox → DevTools

window.orientation is deprecated according to https://developer.mozilla.org/en-US/docs/Web/API/Window/orientation so I will close this bug as wontfix.

Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → WONTFIX
Reporter

Comment 6

3 months ago

Please don't close this. The point is not if window.orientation or window.screen.orientation but that the state doesn't get updated/set in responsive view in either; e.g. when you choose iPad or iPhone in portrait mode the screenOrientation object shows angle: 0; type: "landscape-primary"

It looks like window.screen.orientation is still supported and we can re-orient the bug around updating that object's behavior.

Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Summary: Update orientation state in Responsive Design Mode → Update orientation state (window.screen.orientation) in Responsive Design Mode

Good point, I got carried away with the window.orientation example but indeed we need to fix it for window.screen.orientation. I added it to our quality backlog.

Whiteboard: [rdm-v2] → [rdm-v2][dt-q]
Status: REOPENED → NEW
Priority: P3 → P2
Whiteboard: [rdm-v2][dt-q] → [rdm-mvp] [dt-q]

Spec algorithm for determining proper value of screen.orientation is at: https://w3c.github.io/screen-orientation/#updating-the-orientation-information

Assignee

Updated

2 months ago
See Also: → 1509255
Assignee

Updated

2 months ago
Assignee: nobody → mtigley
Status: NEW → ASSIGNED
Priority: P2 → P1
Assignee

Comment 10

2 months ago

Following the suggested approach here, we can extend the "orientationchange" event handler to update the values of window.screen.orientation and even window.screen.angle on the content document.

Since orientation and angle are readonly attributes we can't simply modify them directly. Perhaps the next step here is to expose some webidl property allows setting these values only while in RDM. We may be able to reuse SetCurrentOrientationsomewhere.

Assignee

Updated

Last month
Blocks: 1549827
Assignee

Updated

Last month
Keywords: leave-open

Comment 13

Last month
Pushed by mtigley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/90ff166702b5
Part 1: Add a 'SetCurrentRDMPaneOrientation' WebIDL extension on the Document r=bradwerth,smaug

Comment 16

Last month
Pushed by mtigley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1256739720ca
Part 1: Add a 'SetCurrentRDMPaneOrientation' WebIDL extension on the Document r=bradwerth,smaug

Comment 19

29 days ago
Pushed by mtigley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b638269d62f1
Part 2: Add the ability to update orientation state of a simulated device in RDM r=gl
Assignee

Updated

29 days ago
Keywords: leave-open

Comment 20

28 days ago
bugherder
Status: ASSIGNED → RESOLVED
Closed: 3 months ago28 days ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 69
You need to log in before you can comment on or make changes to this bug.