Skip to content

Commit

Permalink
chore(guideline): add simple index handling
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Oct 12, 2023
1 parent f37bd83 commit f3a2f27
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 35 deletions.
38 changes: 15 additions & 23 deletions RULES.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
# web-accessibility-rules

List of techniques we want to have and whether we have it handled or not for WCAG.
List of techniques we want to have and whether we have it handled or not for [WCAG2.1](https://www.w3.org/TR/WCAG21/).

## WCAG 2.0
## WCAG 2.1

### WCAGA

| Technique | Description | Type | Complete |
| -------------------------------------------------- | ------------------------------------ | ----- | -------- |
| [H25](https://www.w3.org/TR/WCAG20-TECHS/H25.html) | empty titles | error ||
| [H30](https://www.w3.org/TR/WCAG20-TECHS/H30.html) | text alternative img | error ||
| [H32](https://www.w3.org/TR/WCAG20-TECHS/H32.html) | missing form submit button | error ||
| [H36](https://www.w3.org/TR/WCAG20-TECHS/H36.html) | missing form img alt | error ||
| [H37](https://www.w3.org/TR/WCAG20-TECHS/H37.html) | missing img alt | error ||
| [H42](https://www.w3.org/TR/WCAG20-TECHS/H42.html) | heading found with no content | error ||
| [H57](https://www.w3.org/TR/WCAG20-TECHS/H57.html) | html contains valid lang | error ||
| [H64](https://www.w3.org/TR/WCAG20-TECHS/H64.html) | iframe missing title | error ||
| [F40](https://www.w3.org/TR/WCAG20-TECHS/F40.html) | meta redirect used with a time limit | error ||
| [F40](https://www.w3.org/TR/WCAG20-TECHS/F41.html) | meta refresh used to reload the page | error ||
| [F47](https://www.w3.org/TR/WCAG20-TECHS/F47.html) | blink element used for attention | error ||

### WCAGAA

### WCAGAAA

## WCAG 3.0
| Technique | Description | WCAG | | Type | Complete |
| -------------------------------------------------- | ------------------------------------ | ----- | ----- | -------- |
| [H25](https://www.w3.org/TR/WCAG20-TECHS/H25.html) | empty titles | A-AAA | error ||
| [H30](https://www.w3.org/TR/WCAG20-TECHS/H30.html) | text alternative img | A-AAA | error ||
| [H32](https://www.w3.org/TR/WCAG20-TECHS/H32.html) | missing form submit button | A-AAA | error ||
| [H36](https://www.w3.org/TR/WCAG20-TECHS/H36.html) | missing form img alt | A-AAA | error ||
| [H37](https://www.w3.org/TR/WCAG20-TECHS/H37.html) | missing img alt | A-AAA | error ||
| [H42](https://www.w3.org/TR/WCAG20-TECHS/H42.html) | heading found with no content | A-AAA | error ||
| [H57](https://www.w3.org/TR/WCAG20-TECHS/H57.html) | html contains valid lang | A-AAA | error ||
| [H64](https://www.w3.org/TR/WCAG20-TECHS/H64.html) | iframe missing title | A-AAA | error ||
| [F40](https://www.w3.org/TR/WCAG20-TECHS/F40.html) | meta redirect used with a time limit | A-AAA | error ||
| [F40](https://www.w3.org/TR/WCAG20-TECHS/F41.html) | meta refresh used to reload the page | A-AAA | error ||
| [F47](https://www.w3.org/TR/WCAG20-TECHS/F47.html) | blink element used for attention | A-AAA | error ||
24 changes: 12 additions & 12 deletions accessibility-rs/src/engine/rules/wcag_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,20 @@ impl Principle {
pub enum Guideline {
/// Provide text alternatives for any non-text content so that it can be changed into other forms people need.
TextAlternatives,
/// Create content that can be presented in different ways (for example simpler layout) without losing information or structure.
Adaptable,
/// Make it easier for users to see and hear content including separating foreground from background.
Distinguishable,
/// Provide users enough time to read and use content.
EnoughTime,
/// Do not design content in a way that is known to cause seizures.
Seizures,
/// Provide ways to help users navigate, find content, and determine where they are.
Navigable,
/// Make text content readable and understandable.
Readable,
/// Make Web pages appear and operate in predictable ways.
Predictable,
/// Provide users enough time to read and use content.
EnoughTime,
/// Create content that can be presented in different ways (for example simpler layout) without losing information or structure.
Adaptable,
}

impl Guideline {
Expand All @@ -77,21 +81,17 @@ impl Guideline {
match self {
Guideline::TextAlternatives => "Guideline1_1",
Guideline::Adaptable => "Guideline1_3",
Guideline::Distinguishable => "Guideline1_4",
Guideline::EnoughTime => "Guideline2_2",
Guideline::Seizures => "Guideline2_3",
Guideline::Navigable => "Guideline2_4",
Guideline::Readable => "Guideline3_1",
Guideline::Predictable => "Guideline3_2",
}
}
/// the principle index
pub fn as_index(&self) -> &'static str {
match self {
Guideline::TextAlternatives => "1_1",
Guideline::Adaptable => "1_3",
Guideline::EnoughTime => "2_2",
Guideline::Navigable => "2_4",
Guideline::Readable => "3_1",
Guideline::Predictable => "3_2",
}
let s = self.as_str();
&s[9..s.len()]
}
}

0 comments on commit f3a2f27

Please sign in to comment.