Rule
Orientation lock
Content must work in both portrait and landscape.
- Rule
orientation-lock- WCAG 2.2
- 1.3.4 Orientation (opens in a new tab) (Level AA)
- Severity
- Serious
What it checks
Content should work in portrait and landscape. The rule reads the page's stylesheets for a rule inside an @media (orientation: portrait) or (orientation: landscape) block that hides the whole page, with display: none or visibility: hidden on html or body, or turns it a quarter turn to force the other orientation. Either fails, whether or not the device is in that orientation now.
Orientation queries that restyle or hide parts of the page pass: that is ordinary responsive design. A later declaration that undoes the lock in the same orientation also passes. Stylesheets from other origins cannot be read, and a lock set by script is not visible to the rule.
Example
Fails
<style>
@media (orientation: portrait) {
body { display: none; }
}
</style>
<h1>Seat map</h1>
Passes
<style>
@media (orientation: portrait) {
.seat-key { display: none; }
}
</style>
<h1>Seat map</h1>
<p class="seat-key">Blue seats have extra legroom.</p>
The engine is tested against both examples.
How to fix it
Let the layout adapt to both orientations instead of hiding or rotating the page. The criterion allows a single orientation only where it is essential, such as a piano app; if that is the case, the finding can be dismissed.
Check your own pages
This rule runs in every pour audit: the browser extension, the bookmarklet, the command line and the editor. Get pour, free.