Success Criterion 1.3.4 - Level AA
Orientation
Ensure that the screen content rotates with the device display. All screens of an app must be usable in all orientations. Users in wheelchairs sometimes have their device mounted horizontally. People who use an enlarged font also often rotate their device so that more words fit on the screen.
Impact
This is important for users who have their screen mounted horizontally on a wheelchair and cannot rotate it.
1 in 3 people use an enlarged font. Horizontal orientation makes text easier to read with a (very) large font.
Check
“Does the screen content rotate when you rotate your device?”
This can be tested visually, no assistive technology is needed.
Solution
Allow multiple screen orientations
On Android, make sure that the android:screenOrientation
attribute is not used anywhere.
Open Android Studio and press the Shift key twice to open the search dialog. Search for “android:screenOrientation”. In case there are search results, remove the attribute.
You probably need to make additional code adjustments to make sure the all orientations are working as intended.
To listen to orientation changes, add android:configChanges="orientation"
to your manifest. Then, override the onConfigurationChanged
to receive configuration notifications. Use the orientation
property of the Configuration
object to check the new orientation.
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
when (newConfig.orientation) {
Configuration.ORIENTATION_PORTRAIT -> {
// Portrait logic
}
Configuration.ORIENTATION_LANDSCAPE -> {
// Landscape logic
}
else -> {
// Ignored
}
}
}