Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Rule: css-orientation-is-not-locked #851

Closed
jeeyyy opened this issue Apr 19, 2018 · 8 comments
Closed

New Rule: css-orientation-is-not-locked #851

jeeyyy opened this issue Apr 19, 2018 · 8 comments
Assignees
Labels
rules Issue or false result from an axe-core rule wcag 2.1

Comments

@jeeyyy
Copy link
Contributor

jeeyyy commented Apr 19, 2018

css-orientation-is-not-locked

The rule should test that the content is not locked to any specific display orientation, and functionality of the content is operable in all display orientations (portrait/ landscape).

Tags: wcag21, wcag262

Matcher

Element(s) to be tested is deciphered at run-time based on the tag(s) for which the orientation style is applied.

Checks

Needs review
Check media-queries targeting orientation, and look for transform styles applied to any elements, which aims to lock orientation.

An example snippet is as below:

@media screen and (min-width: 320px) and (max-width: 767px) and (orientation: landscape) {
  html {
    transform: rotate(-90deg);
    transform-origin: left top;
    width: 100vh;
    overflow-x: hidden;
    position: absolute;
    top: 100%;
    left: 0;
  }
}

Note: This should also cover portrait mode.

Proposal

Refer - #906

@jeeyyy jeeyyy added the rules Issue or false result from an axe-core rule label Apr 19, 2018
@jeeyyy jeeyyy added this to the Q2 2018 update milestone Apr 19, 2018
@WilcoFiers
Copy link
Contributor

I don't really understand the checks you are proposing. What I would suggest is that we check if someone used this CSS orientation lock trick:

https://css-tricks.com/snippets/css/orientation-lock/
https://gist.github.com/visnup/2605440

@isner
Copy link
Contributor

isner commented Apr 19, 2018

I think one of your tags in inaccurate. The Orientation success criterion in WCAG 2.1 is 2.6.2, not 2.6.1.

@isner
Copy link
Contributor

isner commented Apr 19, 2018

It seems to me that an automated rule for this SC will only be able to raise a "needs review" at best because of the "essential" exemption:

Content does not restrict its view and operation to a single display orientation, such as portrait or landscape, unless a specific display orientation is essential.

Just an observation.

@jeeyyy
Copy link
Contributor Author

jeeyyy commented Apr 20, 2018

Implementation Options:

Option 1:

  • Iterate every DOM element.
  • getComputedStyle for the element.
  • Verify that an orientation lock is not applied via the css rule.

Option 2: (this is possible via an extension)

@WilcoFiers
Copy link
Contributor

I think option 2 would be best.

@jeeyyy jeeyyy changed the title New Rule: css-orientation-is-not-locked New Rule: css-orientation-is-not-locked (Parked) May 8, 2018
@jeeyyy
Copy link
Contributor Author

jeeyyy commented May 9, 2018

Preliminary commits for these work are below:

@jeeyyy jeeyyy changed the title New Rule: css-orientation-is-not-locked (Parked) (PARKED) New Rule: css-orientation-is-not-locked May 21, 2018
@jeeyyy jeeyyy changed the title (PARKED) New Rule: css-orientation-is-not-locked New Rule: css-orientation-is-not-locked Jun 5, 2018
@jeeyyy
Copy link
Contributor Author

jeeyyy commented Jun 26, 2018

PR - #971

@jeeyyy jeeyyy closed this as completed Jun 26, 2018
@jeeyyy jeeyyy reopened this Jun 26, 2018
WilcoFiers pushed a commit that referenced this issue Aug 21, 2018
**Note: This PR was branched from previous PR - #971 to have a cleaner commit history (without all the trials to fix CI failures). All reviews/ comments from the above PR has been tacked.**

New rule: 
- WCAG 2.1 rule
- Rule Id: `css-orientation-lock`
- Description: Ensures that the content is not locked to any specific display orientation, and functionality of the content is operable in all display orientations (portrait/ landscape).

Closes Issue:
- #851

## Reviewer checks

**Required fields, to be filled out by PR reviewer(s)**
- [ ] Follows the commit message policy, appropriate for next version
- [ ] Has documentation updated, a DU ticket, or requires no documentation change
- [ ] Includes new tests, or was unnecessary
- [ ] Code is reviewed for security by: << Name here >>
@jeeyyy
Copy link
Contributor Author

jeeyyy commented Aug 23, 2018

#1081 merged. Closing issue.

@jeeyyy jeeyyy closed this as completed Aug 23, 2018
mrtnvh pushed a commit to mrtnvh/axe-core that referenced this issue Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rules Issue or false result from an axe-core rule wcag 2.1
Projects
None yet
Development

No branches or pull requests

6 participants