Skip to content

Commit

Permalink
fix(engine): rule engine refactor and update (#2025)
Browse files Browse the repository at this point in the history
* Code clean up: separate CSSUtil #1974

* code cleanup: use ts classes instead of functions #1974

* refactor the rule code #1974

* code refactor #1974

* code refactor for legacy #1974

* create NodeWalker #1974

* refactor rules #1974

* update the rules #1974

* update the rule engine #1974

* add denug for testing #1974

* add debug for testing #1974

* clear up debug statement #1974

* update rules for resolved role #1974

* update aria definition #1974

* update ethe resolvedRole in rules #1974

* refactor the rule aria_accessiblename_exists #1974

* add console logs for debugging  #1974

* update the rules #1974

* refactor isNodeVisible function #1974

* refactor isNodeVisible #1974

* update the role calculation #1974

* update the common util #1974

* update the aria path which contains presentation  #1974

* update accessible name calculation #1974

* update the CommonUtil #1974

* update svg and ariaautocomplete calculation #1974

* update svg rule to use accNameUtil #1974

* Update AccNameUtil #1974

* update the rules for accessible name calculation #1974

* update accName #1974

* update rules to use new Acc name calculation #1974

* update the rule for acc name #1974

* update the rules to use new acc name calculation #1974

* update the rules and test cases #1974

* update the rules to use accessible name calculation #1974

* update the rules to use new accessible name #1974

* fix merge error #1974

* fix the baselines #1974

* update the selenium baselines #1974

* Update JSONObjectStructureVerification.html.json

* Update JSONObjectStructureVerificationSelenium.html.json

* Update violations.json

* Update DOMWalker.ts

* fix the error "TypeError: Cannot read properties of null (reading 'nodeType')" from the cache #1974

* Update label_name_visible.ts

* update target spacing rule #1974

* update spaing rule #1974

* update DOMWalker #1974

* recalculate the inline text status #1974

* update spacing rule and test results #1974

* clean up the code #1974

* fix the baseline #1974

* update the baseline #1974

* update the baselines #1974

* update puppeteer test skip file list #1974

* update ignored test files #1974

* skip 3 test files #1974

* skip three test files in java test #1974

* java test file update #1974

* Update AccessibilityCheckerSeleniumFFTest.java

* clean up the code #1974

* remove util package from dependency #1974

* Fix wording typo #1974

* Protect from walking at the document level

* Missing space

* update the test case #1974

* Path fix?

* Handle slot assignments better

* Fix sibling accidentally entering slot

* Update the ARIA Walker

* Kill hang

---------

Co-authored-by: Tom Brunet <[email protected]>
  • Loading branch information
shunguoy and tombrunet authored Nov 6, 2024
1 parent 72d5d27 commit 53aba40
Show file tree
Hide file tree
Showing 244 changed files with 8,846 additions and 7,646 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ <h3 id="ruleMessage"></h3>

### Why is this important?

A `<label>` element is attached to a specific `<input>` element through the `for` attribute.
When a `<label>` does not reference the corresponding unique `id` in a valid `<input>` element,
A `<label>` element is attached to a specific element, such as `<input>` and `<select>`, through the `for` attribute.
When a `<label>` does not reference the corresponding unique `id` in a valid element,
assistive technologies cannot associate the label with the element.

<!-- This is where the code snippet is injected -->
<div id="locSnippet"></div>

### What to do

* Set the value of the `for` attribute to the `id` value of the valid `<input>` element to be labeled. Make sure the `id` value is unique.
* Set the value of the `for` attribute to the `id` value of the valid element to be labeled. Make sure the `id` value is unique.

For example:

Expand Down
4 changes: 3 additions & 1 deletion accessibility-checker-engine/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
// { pattern: 'test/v2/checker/accessibility/rules/Rpt_Aria_RequiredParent_Native_Host_Sematics_ruleunit/ACT_ff89c9_pass4.html', watched: true },
//{ pattern: 'test/v2/checker/accessibility/rules/label_name_visible_ruleunit/label_offscreen.html', watched: true },
//{ pattern: 'test/v2/checker/accessibility/rules/aria_role_valid_ruleunit/td_attribute_invalid_copy.html', watched: true },
//{ pattern: 'test/v2/checker/accessibility/rules/label_name_visible_ruleunit/label_multiple_offscreen.html', watched: true },
//{ pattern: 'test/v2/checker/accessibility/rules/text_block_heading_ruleunit/Headings-noneUsedEmphasizedText.html', watched: true },
{ pattern: 'test/v2/checker/accessibility/rules/aria_parent_required_ruleunit/webComponentPass.html', watched: true },
{ pattern: 'test/v2/checker/accessibility/rules/aria_parent_required_ruleunit/webComponentPass2.html', watched: true },


{ pattern: 'test/**/*_ruleunit/*.html', watched: true },
Expand Down
10 changes: 5 additions & 5 deletions accessibility-checker-engine/src/v2/api/IEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,27 +65,27 @@ export { eGuidelineType as eRulesetType } from "../../v4/api/IGuideline";
/**
* @deprecated See ../../v4/api/IRule
*/
export let RulePass = RulePassNew;
export const RulePass = RulePassNew;

/**
* @deprecated See ../../v4/api/IRule
*/
export let RuleRender = RuleRenderNew;
export const RuleRender = RuleRenderNew;

/**
* @deprecated See ../../v4/api/IRule
*/
export let RuleFail = RuleFailNew;
export const RuleFail = RuleFailNew;

/**
* @deprecated See ../../v4/api/IRule
*/
export let RulePotential = RulePotentialNew;
export const RulePotential = RulePotentialNew;

/**
* @deprecated See ../../v4/api/IRule
*/
export let RuleManual = RuleManualNew;
export const RuleManual = RuleManualNew;

/**
* @deprecated See ../../v4/api/IRule
Expand Down
21 changes: 17 additions & 4 deletions accessibility-checker-engine/src/v2/aria/ARIADefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,19 @@ export class ARIADefinitions {
deprecatedProps: ['aria-disabled', 'aria-errormessage', 'aria-haspopup', 'aria-invalid']
},

"image": {
container: null,
props: null,
reqProps: null,
reqChildren: null,
htmlEquiv: "img",
roleType: "structure",
nameRequired: true,
nameFrom: ["author"],
presentationalChildren: true,
deprecatedProps: ['aria-disabled', 'aria-errormessage', 'aria-haspopup', 'aria-invalid']
},

"insertion": {
container: null,
props: null,
Expand Down Expand Up @@ -1801,7 +1814,7 @@ export class ARIADefinitions {
},
"button": {
implicitRole: ["button"],
validRoles: ["checkbox", "combobox", "gridcell", "link", "menuitem", "menuitemcheckbox", "menuitemradio", "option", "radio", "slider", "switch", "tab", "treeitem"],
validRoles: ["checkbox", "combobox", "gridcell", "link", "menuitem", "menuitemcheckbox", "menuitemradio", "option", "radio","separator", "slider", "switch", "tab", "treeitem"],
globalAriaAttributesValid: true
},
"canvas": {
Expand Down Expand Up @@ -1914,7 +1927,7 @@ export class ARIADefinitions {
globalAriaAttributesValid: false
},
"hgroup": {
implicitRole: ["generic"],
implicitRole: ["group"],
validRoles: ["any"],
globalAriaAttributesValid: true
},
Expand Down Expand Up @@ -2839,14 +2852,14 @@ export class ARIADefinitions {
htmlAttributeValues: null
}]
},
"aria-autocomplete": {
/** "aria-autocomplete": {
conflict: [{
// conflict occurs if both exists, aria value is only for custom widget, rather than native
ariaAttributeValue: null,
htmlAttributeNames: ["autocomplete"],
htmlAttributeValues: null
}]
}
} */
}

static containers = []
Expand Down
Loading

0 comments on commit 53aba40

Please sign in to comment.