Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orientation not working properly in Safari on iOS 16 #367

Open
samuelsimoes opened this issue Apr 25, 2023 · 1 comment
Open

Orientation not working properly in Safari on iOS 16 #367

samuelsimoes opened this issue Apr 25, 2023 · 1 comment
Labels
bug-major Bugs that are affecting production users.

Comments

@samuelsimoes
Copy link

samuelsimoes commented Apr 25, 2023

Safari on iOS 16 exposes the screen.orientation property now, but from what I've seen, it only returns the correct information after the screen rotation animation has finished. However, the orientationchange event is invoked as soon as the animation starts, causing an issue with detecting the current orientation, as it always returns the previous orientation instead.

To fix this, I suggest moving the iOS-specific code block

current-device/src/index.js

Lines 181 to 186 in af95870

if (
device.ios() &&
Object.prototype.hasOwnProperty.call(window, 'orientation')
) {
return Math.abs(window.orientation) === 90
}
to the top of the general detection routine. This way, iOS will always use window.orientation, which continues to work as expected.

@matthewhudson matthewhudson added the bug-major Bugs that are affecting production users. label Dec 5, 2023
@subfighter3
Copy link

Looks like this issue has not being addressed yet… can somebody pack this solution into the main branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-major Bugs that are affecting production users.
Projects
None yet
Development

No branches or pull requests

3 participants