screen-orientation-lock
Views must not restrict their view and operation to a single display orientation, such as portrait or landscape.
Who might be affected
Motor/Mobility
Cognitive
Keyboard
Description
Some assistive technologies do not support a certain screen orientation or their users may be unable to access the orientation features of the device. When an app is restricted to only one orientation these users may not be able to use it.
Quick Fixes
iOS
Xcode GUI (applies to the entire app)
Esure that under “Device Orientation” all the checkboxes are either unchecked (the default) or checked.
UIKit (applies to the entire app)
(Bad)
1// BAD2@main3class AppDelegate: UIResponder, UIApplicationDelegate {45 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {6 // Override point for customization after application launch.7 return true8 }910 func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {11 .portrait12 }1314 // MARK: UISceneSession Lifecycle1516 func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {17 // Called when a new scene session is being created.18 // Use this method to select a configuration to create the new scene with.19 return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)2021 }22}
(Good)
1@main2class AppDelegate: UIResponder, UIApplicationDelegate {34 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {5 // Override point for customization after application launch.6 return true7 }89 // MARK: UISceneSession Lifecycle1011 func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {12 // Called when a new scene session is being created.13 // Use this method to select a configuration to create the new scene with.14 return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)15 }16}
1@main2class AppDelegate: UIResponder, UIApplicationDelegate {34 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {5 // Override point for customization after application launch.6 return true7 }89 func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {10 .all11 }1213 // MARK: UISceneSession Lifecycle1415 func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {16 // Called when a new scene session is being created.17 // Use this method to select a configuration to create the new scene with.18 return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)19 }20}
1@main2class AppDelegate: UIResponder, UIApplicationDelegate {34 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {5 // Override point for customization after application launch.6 return true7 }89 func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {10 .allButUpsideDown11 }1213 // MARK: UISceneSession Lifecycle1415 func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {16 // Called when a new scene session is being created.17 // Use this method to select a configuration to create the new scene with.18 return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)19 }20}
UIKit (specific view controller)
(Bad)
1class ViewController: UIViewController {23 override func viewDidLoad() {4 super.viewDidLoad()5 // Do any additional setup after loading the view.6 }78 override var supportedInterfaceOrientations: UIInterfaceOrientationMask {9 ✗ get { .portrait }10 }11}
(Good)
1import UIKit23class ViewController: UIViewController {45 override func viewDidLoad() {6 super.viewDidLoad()7 // Do any additional setup after loading the view.8 }910 override var supportedInterfaceOrientations: UIInterfaceOrientationMask {11 ✓ get { .all }12 }13}
Android
AndroidManifest.xml
(Bad)
1<activity2 android:name=".presentation.main.MainActivity"3 android:launchMode="singleInstance"4✗ android:screenOrentation="landscape"5 tools:ignore="LockedOrientationActivity">6 <intent-filter>7 <action android:name="android.intent.action.MAIN" />8 <actegory android:name="android.intent.category.LAUNCHER" />9 </intent-filter>10</activity>
(Bad)
1<activity2 android:name=".presentation.main.MainActivity"3 android:launchMode="singleInstance"4✗ android:screenOrentation="portrait"5 tools:ignore="LockedOrientationActivity">6 <intent-filter>7 <action android:name="android.intent.action.MAIN" />8 <actegory android:name="android.intent.category.LAUNCHER" />9 </intent-filter>10</activity>
(Good, no screen orientation is specified)
1✓2<activity3 android:name=".presentation.main.MainActivity"4 android:launchMode="singleInstance">5 <intent-filter>6 <action android:name="android.intent.action.MAIN" />7 <actegory android:name="android.intent.category.LAUNCHER" />8 </intent-filter>9</activity>
(Good, no screen orientation is specified)
1<activity2 android:name=".presentation.main.MainActivity"3 android:launchMode="singleInstance"4✓ android:screenOrentation="unspecified">5 <intent-filter>6 <action android:name="android.intent.action.MAIN" />7 <actegory android:name="android.intent.category.LAUNCHER" />8 </intent-filter>9</activity>
How Users Are Affected
Users of assistive technologies which support only a specific screen orientation may not be able to perceive the content or use the app.
WCAG Success criteria
This issue might cause elements to fail one or more of the following Success criteria:
1.3.4 Orientation (AA)