Closed Bug 1357774 Opened 8 years ago Closed 6 years ago

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

Categories

(DevTools :: Responsive Design Mode, defect, P1)

52 Branch
defect

Tracking

(firefox69 fixed)

RESOLVED FIXED
Firefox 69
Tracking Status
firefox69 --- fixed

People

(Reporter: mail.eraserhead, Assigned: mtigley)

References

(Blocks 2 open bugs)

Details

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

Attachments

(2 files)

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.
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]
>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).
P.S. Not that it matters much, but mobile IE also only supports "window.orientation" - I just checked.
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.
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: 6 years ago
Resolution: --- → WONTFIX

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

See Also: → 1509255
Assignee: nobody → mtigley
Status: NEW → ASSIGNED
Priority: P2 → P1

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.

Blocks: 1549827
Keywords: leave-open
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
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
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
Keywords: leave-open
Status: ASSIGNED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 69
QA Whiteboard: [qa-69b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: