For review
- Main change from the original example, if screen orientation is not supported then `screen.orientation.type.startsWith` and `screen.orientation.add/remove.Event.Listener` should also not be used.
- I changed the event listener to `window.add/removeEventListener("orientationchange")`.
- I used `window.matchMedia("(orientation: portrait)").matches` to check the orientation. However I have tested on iOS and android with differing results! Available to test here https://johanna-hub.github.io/example-3/
- Safari and Chrome on iOS the example works completely fine.
- Chrome and Firefox on Android, the final completed alert only comes up once you have rotated back to portrait (same thing happens in devtools responsive mode on Chrome)
I think the matchMedia querylist needs a listener but then it gets too complicated! So might be better to do if(screen.width>screen.height) just for the purposes of demonstration of the concept.
You can view, comment on, or merge this pull request online at:
https://github.com/w3c/screen-orientation/pull/135
-- Commit Summary --
* Editorial: Example 3
* HTML Tidy
-- File Changes --
M index.html (43)
-- Patch Links --
https://github.com/w3c/screen-orientation/pull/135.patch
https://github.com/w3c/screen-orientation/pull/135.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/screen-orientation/pull/135