css-orientation-lock

CSS must not lock the page to a single orientation

automaticWCAG 1.3.4 (AA)confidence: highseverity: seriousperceivable

Checks that no @media (orientation: portrait|landscape) rule sets a transform: rotate(...) on the page, a known technique for defeating device orientation.

Applies to. Any accessible (same-document, non-cross-origin) stylesheet, inline `<style>` blocks and same-origin `<link>` stylesheets already loaded into `document.styleSheets`.

Expectation. No `@media (orientation: portrait)` or `@media (orientation: landscape)` block sets a `transform`/`-webkit-transform`/`rotate` rotation of approximately 90 degrees (mod 180, i.e. ~90 or ~270), the well-known technique for visually forcing one orientation regardless of the device's actual orientation, which defeats WCAG 1.3.4's requirement that content not restrict its view to a single display orientation unless that orientation is essential.

Examples

pass
<html>
<head>
<title>Page title</title>
<style>body { background: #fff; }</style>
</head>
<body>Hi</body>
</html>

No orientation media query rotates the page.

fail
<html>
<head>
<title>Page title</title>
<style>
@media (orientation: landscape) {
body { transform: rotate(90deg); }
}
</style>
</head>
<body>Hi</body>
</html>

A landscape media query forces a 90-degree rotation, locking the page to portrait regardless of device orientation.

View source