From a68f7f4c185e455add70120d8a43d297c0c456ea Mon Sep 17 00:00:00 2001 From: Elizaveta Selyukovich Date: Wed, 13 Mar 2024 18:36:25 +0300 Subject: [PATCH] Add the ability to create pages for an md file --- config-overrides.js | 8 +- src/common/components/AppPages.js | 9 +- src/common/components/AppRouter.js | 10 +- .../components/layouts/header/Header.js | 5 +- .../About.js => markdownPage/MarkdownPage.js} | 12 +- .../MarkdownPage.scss} | 2 +- .../pages/privacyPolicy/PrivacyPolicy.js | 23 - .../pages/privacyPolicy/PrivacyPolicy.scss | 13 - src/common/services/fileService.js | 3 +- src/static/wiki_WCAG2.2_human.md | 673 ++++++++++++++++++ src/static/wiki_WCAG2.2_machine.md | 201 ++++++ 11 files changed, 900 insertions(+), 59 deletions(-) rename src/common/components/layouts/pages/{about/About.js => markdownPage/MarkdownPage.js} (65%) rename src/common/components/layouts/pages/{about/About.scss => markdownPage/MarkdownPage.scss} (92%) delete mode 100644 src/common/components/layouts/pages/privacyPolicy/PrivacyPolicy.js delete mode 100644 src/common/components/layouts/pages/privacyPolicy/PrivacyPolicy.scss create mode 100644 src/static/wiki_WCAG2.2_human.md create mode 100644 src/static/wiki_WCAG2.2_machine.md diff --git a/config-overrides.js b/config-overrides.js index 12f1bf33..95866e18 100644 --- a/config-overrides.js +++ b/config-overrides.js @@ -22,12 +22,8 @@ module.exports = function override(config) { to: 'pdf.worker.js.map', }, { - from: 'src/static/ABOUT.md', - to: 'ABOUT.md', - }, - { - from: 'src/static/PRIVACY_POLICY.md', - to: 'PRIVACY_POLICY.md', + from: 'src/static', + to: './', }, ], }) diff --git a/src/common/components/AppPages.js b/src/common/components/AppPages.js index 7698fd9f..0b458fbb 100644 --- a/src/common/components/AppPages.js +++ b/src/common/components/AppPages.js @@ -19,8 +19,13 @@ export default { return `/jobs/${id}/result-details`; }, }, - ABOUT: '/about', - PRIVACY_POLICY: '/privacy-policy', + MARKED: { + // [fileName]: pathName + ABOUT: '/about', + PRIVACY_POLICY: '/privacy-policy', + 'wiki_WCAG2.2_human': '/wcag-2-2-human', + 'wiki_WCAG2.2_machine': '/wcag-2-2-machine', + }, LOADING: '/loading', NOT_FOUND: '/404', }; diff --git a/src/common/components/AppRouter.js b/src/common/components/AppRouter.js index 59a00251..797da4af 100644 --- a/src/common/components/AppRouter.js +++ b/src/common/components/AppRouter.js @@ -2,8 +2,7 @@ import React from 'react'; import { Redirect, Route, Switch } from 'react-router-dom'; import Upload from './layouts/pages/upload/Upload'; -import About from './layouts/pages/about/About'; -import PrivacyPolicy from './layouts/pages/privacyPolicy/PrivacyPolicy'; +import MarkdownPage from './layouts/pages/markdownPage/MarkdownPage'; import Settings from './layouts/pages/settings/Settings'; import JobStatus from './layouts/pages/status/JobStatus'; import Results from './layouts/pages/results/Results'; @@ -18,8 +17,11 @@ function AppRouter() { - - + {Object.keys(AppPages.MARKED).map(page => ( + + + + ))} diff --git a/src/common/components/layouts/header/Header.js b/src/common/components/layouts/header/Header.js index 34702ec9..b410dad5 100644 --- a/src/common/components/layouts/header/Header.js +++ b/src/common/components/layouts/header/Header.js @@ -22,11 +22,10 @@ function Header() {
diff --git a/src/common/components/layouts/pages/about/About.js b/src/common/components/layouts/pages/markdownPage/MarkdownPage.js similarity index 65% rename from src/common/components/layouts/pages/about/About.js rename to src/common/components/layouts/pages/markdownPage/MarkdownPage.js index f80a52da..4485f613 100644 --- a/src/common/components/layouts/pages/about/About.js +++ b/src/common/components/layouts/pages/markdownPage/MarkdownPage.js @@ -1,23 +1,23 @@ import React, { useEffect, useState } from 'react'; import { marked } from 'marked'; -import './About.scss'; +import './MarkdownPage.scss'; -function About() { +function MarkdownPage({ fileName }) { const [content, setContent] = useState(''); useEffect(() => { const fetchFile = async () => { - const file = await fetch(process.env.PUBLIC_URL + '/ABOUT.md'); + const file = await fetch(process.env.PUBLIC_URL + `/${fileName}.md`); const content = await file.text(); setContent(marked(content)); }; fetchFile().catch(console.error); - }, []); + }, [fileName]); return ( -
+
); } -export default About; +export default MarkdownPage; diff --git a/src/common/components/layouts/pages/about/About.scss b/src/common/components/layouts/pages/markdownPage/MarkdownPage.scss similarity index 92% rename from src/common/components/layouts/pages/about/About.scss rename to src/common/components/layouts/pages/markdownPage/MarkdownPage.scss index 2184c8b8..42d5396e 100644 --- a/src/common/components/layouts/pages/about/About.scss +++ b/src/common/components/layouts/pages/markdownPage/MarkdownPage.scss @@ -1,4 +1,4 @@ -.about { +.markdown { padding: 0 20px; a { diff --git a/src/common/components/layouts/pages/privacyPolicy/PrivacyPolicy.js b/src/common/components/layouts/pages/privacyPolicy/PrivacyPolicy.js deleted file mode 100644 index 7ea1dfe9..00000000 --- a/src/common/components/layouts/pages/privacyPolicy/PrivacyPolicy.js +++ /dev/null @@ -1,23 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import { marked } from 'marked'; - -import './PrivacyPolicy.scss'; - -function PrivacyPolicy() { - const [content, setContent] = useState(''); - useEffect(() => { - const fetchFile = async () => { - const file = await fetch(process.env.PUBLIC_URL + '/PRIVACY_POLICY.md'); - const content = await file.text(); - setContent(marked(content)); - }; - fetchFile().catch(console.error); - }, []); - return ( -
-
-
- ); -} - -export default PrivacyPolicy; diff --git a/src/common/components/layouts/pages/privacyPolicy/PrivacyPolicy.scss b/src/common/components/layouts/pages/privacyPolicy/PrivacyPolicy.scss deleted file mode 100644 index 10d4632f..00000000 --- a/src/common/components/layouts/pages/privacyPolicy/PrivacyPolicy.scss +++ /dev/null @@ -1,13 +0,0 @@ -.privacy-policy { - padding: 0 20px; - - a { - color: #914148; - font-weight: 500; - text-decoration: none; - - &:hover { - color: #673346; - } - } -} diff --git a/src/common/services/fileService.js b/src/common/services/fileService.js index 5aa3f873..c668a2a0 100644 --- a/src/common/services/fileService.js +++ b/src/common/services/fileService.js @@ -5,7 +5,8 @@ import AppPages from '../components/AppPages'; const { REACT_APP_API_ROOT, PUBLIC_URL } = process.env; -const STATIC_PAGES = ['', AppPages.UPLOAD, AppPages.ABOUT, AppPages.PRIVACY_POLICY, AppPages.NOT_FOUND].map( +const STATIC_MARKED_PAGES = Object.values(AppPages.MARKED); +const STATIC_PAGES = ['', AppPages.UPLOAD, AppPages.NOT_FOUND, ...STATIC_MARKED_PAGES].map( pageURL => `${PUBLIC_URL}${pageURL}` ); diff --git a/src/static/wiki_WCAG2.2_human.md b/src/static/wiki_WCAG2.2_human.md new file mode 100644 index 00000000..a58d8989 --- /dev/null +++ b/src/static/wiki_WCAG2.2_human.md @@ -0,0 +1,673 @@ +# WCAG2.2 validation rules +## Rule 1.3.1-3 + +### Requirement + +>*Underlined text is used outside of the link context* + +### Error details + +Non-link underlined text + +* Object type: `SATextChunk` +* Test condition: `isUnderlined == false || parentsStandardTypes.split('&').filter(elem => (elem == 'Link' || elem == 'Reference')).length > 0` +* Severity: cosmetic + +## Rule 1.3.1-4 + +### Requirement + +>*Text has visually different presentation suggesting the semantics of Span, Em, Strong or other appropriate inline element* + +### Error details + +Text has a different style but no semantic tagging + +* Object type: `SATextChunk` +* Test condition: `hasSpecialStyle == false || parentsStandardTypes.split('&').filter(elem => elem == 'Figure').length > 0` +* Severity: minor + +## Rule 1.4.8-1 + +### Requirement + +>*Font used for text rendering is not recommended for accessibility* + +### Error details + +Inaccessible font + +* Object type: `PDFont` +* Test condition: `fontName != null && fontName.indexOf('AdobeDevanagari') == -1 && fontName.indexOf('AgencyFB') == -1 && fontName.indexOf('BlackadderITC') == -1 && fontName.indexOf('BodoniMTPosterCompressed') == -1 && fontName.indexOf('BradleyHandITC') == -1 && fontName.indexOf('BrushScriptMT') == -1 && fontName.indexOf('Chiller') == -1 && fontName.indexOf('ColonnaMT') == -1 && fontName.indexOf('CurlzMT') == -1 && fontName.indexOf('EdwardianScriptITC') == -1 && fontName.indexOf('ESRIArcGISTDN') == -1 && fontName.indexOf('FreestyleScript') == -1 && fontName.indexOf('FrenchScriptMT') == -1 && fontName.indexOf('Gabriola') == -1 && fontName.indexOf('Gigi') == -1 && fontName.indexOf('GillSansMT-ExtraCondensedBold') == -1 && fontName.indexOf('HarlowSolidItalic') == -1 && fontName.indexOf('Harrington') == -1 && fontName.indexOf('InformalRoman') == -1 && fontName.indexOf('Jokerman') == -1 && fontName.indexOf('FrenchScriptMT') == -1 && fontName.indexOf('Gabriola') == -1 && fontName.indexOf('JuiceITC') == -1 && fontName.indexOf('KunstlerScript') == -1 && fontName.indexOf('Magneto') == -1 && fontName.indexOf('MaturaMTScriptCapitals') == -1 && fontName.indexOf('MicrosoftUighur') == -1 && fontName.indexOf('Mistral') == -1 && fontName.indexOf('OldEnglishTextMT') == -1 && fontName.indexOf('Onyx') == -1 && fontName.indexOf('PalaceScriptMT') == -1 && fontName.indexOf('Parchment') == -1 && fontName.indexOf('Playbill') == -1 && fontName.indexOf('Pristina') == -1 && fontName.indexOf('RageItalic') == -1 && fontName.indexOf('Ravie') == -1 && fontName.indexOf('SegoeScript') == -1 && fontName.indexOf('ShowcardGothic') == -1 && fontName.indexOf('SnapITC') == -1 && fontName.indexOf('Vivaldi') == -1 && fontName.indexOf('VladimirScript') == -1 && (fontName.indexOf('HarlowSolid') == -1 || isItalic != true)` +* Severity: cosmetic + +## Rule 4.1.1-3 + +### Requirement + +>*Merged cells in tables are advised to be avoided for accessibility reasons* + +### Error details + +Table visual appearance has merged cells + +* Object type: `SATableBorderCell` +* Test condition: `colSpan == 1 && rowSpan == 1` +* Severity: cosmetic + +## Rule 4.1.2-1 + +### Requirement + +>*The content is not identified as a single paragraph* + +### Error details + +Incorrect use of P tag + +* Object type: `SAP` +* Test condition: `correctSemanticScore >= 0.75 || correctType == null || correctType == 'H'` +* Severity: minor + +## Rule 4.1.2-2 + +### Requirement + +>*The content is not identified as a single span of text* + +### Error details + +Incorrect use of Span tag + +* Object type: `SASpan` +* Test condition: `correctSemanticScore >= 0.75 || correctType == null` +* Severity: minor + +## Rule 4.1.2-4 + +### Requirement + +>*The content is marked with tag, but is not identified as a heading* + +### Error details + +Incorrect use of H tag + +* Object type: `SAH` +* Test condition: `correctSemanticScore >= 0.75 || correctType == null` +* Severity: minor + +## Rule 4.1.2-5 + +### Requirement + +>*The content is marked with one of

, ..., tags, but is not identified as a heading* + +### Error details + +Incorrect use of Hn tag + +* Object type: `SAHn` +* Test condition: `correctSemanticScore >= 0.75 || correctType == null` +* Severity: minor + +## Rule 4.1.2-8 + +### Requirement + +>*Part of the document is identified as a table, but is not marked as a different Table related structure element* + +### Error details + +Incorrect Table element(s) + +* Object type: `SAStructElem` +* Test condition: `hasLowestDepthError == false || (correctSemanticScore >= 0.75 && standardType == correctType) || (isTableElem != true) || ((correctType != 'TD' || standardType == 'TH') && correctType != 'TR' && correctType != 'TH' && correctType != 'TBody' && correctType != 'THead' && correctType != 'TFoot' && correctType != 'Table') || (standardType == 'L' || parentsStandardTypes.split('&').filter(elem => elem == 'L').length > 0)` +* Severity: minor + +## Rule 4.1.2-9 + +### Requirement + +>*Part of the document is recognized as a table, but is not marked as a Table related structure element* + +### Error details + +Missing Table element(s) + +* Object type: `SAStructElem` +* Test condition: `hasLowestDepthError == false || (correctSemanticScore >= 0.75 && standardType == correctType) || (isTableElem == true) || (correctType != 'TD' && correctType != 'TR' && correctType != 'TH' && correctType != 'TBody' && correctType != 'THead' && correctType != 'TFoot' && correctType != 'Table') || (standardType == 'L' || parentsStandardTypes.split('&').filter(elem => elem == 'L').length > 0)` +* Severity: minor + +## Rule 4.1.2-10 + +### Requirement + +>*Structure element uses

tag, but is recognized as a heading* + +### Error details + +Heading is incorrectly tagged as a paragraph + +* Object type: `SAP` +* Test condition: `correctType != 'H' && correctType != 'Hn'` +* Severity: minor + +## Rule 4.1.2-11 + +### Requirement + +>*Structure element uses

tag, but is recognized as a span* + +### Error details + +Span is incorrectly tagged as a paragraph + +* Object type: `SAP` +* Test condition: `correctType != 'Span'` +* Severity: minor + +## Rule 4.1.2-12 + +### Requirement + +>*Structure element uses tag, but is recognized as a paragraph* + +### Error details + +Paragraph is incorrectly tagged as a span + +* Object type: `SASpan` +* Test condition: `correctType != 'P'` +* Severity: minor + +## Rule 4.1.2-13 + +### Requirement + +>*Structure element uses tag, but is recognized as a heading* + +### Error details + +Heading is incorrectly tagged as a span + +* Object type: `SASpan` +* Test condition: `correctType != 'H' && correctType != 'Hn'` +* Severity: minor + +## Rule 4.1.2-14 + +### Requirement + +>*Structure element uses , but is recognized as a paragraph* + +### Error details + +Paragraph is incorrectly tagged as a heading + +* Object type: `SAH` +* Test condition: `correctType != 'P'` +* Severity: minor + +## Rule 4.1.2-15 + +### Requirement + +>*Structure element uses one of

, ..., tags, but is recognized as a paragraph* + +### Error details + +Paragraph is incorrectly tagged as a numbered heading + +* Object type: `SAHn` +* Test condition: `correctType != 'P'` +* Severity: minor + +## Rule 4.1.2-20 + +### Requirement + +>*Structure element uses

tag, but is recognized as a figure caption* + +### Error details + +Caption is incorrectly tagged as a paragraph + +* Object type: `SAP` +* Test condition: `correctType != 'Caption'` +* Severity: minor + +## Rule 4.1.2-21 + +### Requirement + +>*Part of the document is recognized as a list, but is not marked as a List related structure element* + +### Error details + +Missing List element(s) + +* Object type: `SAStructElem` +* Test condition: `hasLowestDepthError == false || (correctSemanticScore >= 0.75 && standardType == correctType) || (correctType != 'LI' && correctType != 'Lbl' && correctType != 'LBody' && correctType != 'L') || (isTableElem == true)` +* Severity: minor + +## Rule 4.1.2-22 + +### Requirement + +>*The content is marked with tag, but is not identified as a part of a list* + +### Error details + +Invalid List element + +* Object type: `SAL` +* Test condition: `hasLowestDepthError == false || (correctType == 'L' && correctSemanticScore >= 0.75) || correctType == 'TR' || correctType == 'TD' || correctType == 'TH' || correctType == 'TBody' || correctType == 'LI' || correctType == 'Lbl' || correctType == 'LBody' || correctType == 'THead' || correctType == 'TFoot' || correctType == 'Table' || correctType == 'TOC' || correctType == 'TOCI'` +* Severity: minor + +## Rule 4.1.2-23 + +### Requirement + +>*The content is marked with

  • tag, but is not identified as a part of a list* + +### Error details + +Invalid List item element + +* Object type: `SALI` +* Test condition: `hasLowestDepthError == false || (correctType == 'LI' && correctSemanticScore >= 0.75) || correctType == 'L' || correctType == 'Lbl' || correctType == 'LBody' || correctType == 'TR' || correctType == 'TD' || correctType == 'TH' || correctType == 'TBody' || correctType == 'THead' || correctType == 'TFoot' || correctType == 'Table' || correctType == 'TOC' || correctType == 'TOCI'` +* Severity: minor + +## Rule 4.1.2-25 + +### Requirement + +>*The content is marked with tag, but is not identified as a part of a list* + +### Error details + +Invalid List body element + +* Object type: `SALBody` +* Test condition: `hasLowestDepthError == false || (correctType == 'LBody' && correctSemanticScore >= 0.75) || correctType == 'L' || correctType == 'LI' || correctType == 'Lbl' || correctType == 'TR' || correctType == 'TD' || correctType == 'TH' || correctType == 'TBody' || correctType == 'THead' || correctType == 'TFoot' || correctType == 'Table' || correctType == 'TOC' || correctType == 'TOCI'` +* Severity: minor + +## Rule 4.1.2-26 + +### Requirement + +>*The content is identified as a part of a table, but is tagged as a list* + +### Error details + +Table is incorrectly tagged as a list, or a list has invalid numbering + +* Object type: `SAStructElem` +* Test condition: `hasLowestDepthError == false || (correctType != 'TD' && correctType != 'TR' && correctType != 'TH' && correctType != 'TBody' && correctType != 'THead' && correctType != 'TFoot' && correctType != 'Table') || (standardType != 'L' && standardType != 'LI' && standardType != 'Lbl' && standardType != 'LBody')` +* Severity: minor + +## Rule 4.1.2-27 + +### Requirement + +>*The content is identified as two or more paragraphs, but is marked with a single

    tag* + +### Error details + +Several paragraphs tagged as one + +* Object type: `SAP` +* Test condition: `correctType != 'Part' || correctSemanticScore < 0.75` +* Severity: minor + +## Rule 4.1.2-28 + +### Requirement + +>*The content is identified as a part of the table of content, but is not marked with a tag* + +### Error details + +Missing TOC item + +* Object type: `SAStructElem` +* Test condition: `correctType != 'TOCI' || standardType == 'TOCI'` +* Severity: minor + +## Rule 4.1.2-31 + +### Requirement + +>*Page number inside the TOCI element (Table of Content item) does not match the page number of its link destination* + +### Error details + +TOC item points to the wrong page + +* Object type: `SATOCI` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1002).length == 0` +* Severity: minor + +## Rule 4.1.2-32 + +### Requirement + +>* structure element (Table of Content item) is not right aligned with other elements in the same * + +### Error details + +TOC items are not right aligned + +* Object type: `SATOCI` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1003).length == 0` +* Severity: minor + +## Rule 4.1.2-34 + +### Requirement + +>*The context is identified as a continued list, but is split into multiple structure elements* + +### Error details + +Single list is tagged as multiple structure elements + +* Object type: `SAStructElem` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1200).length == 0` +* Severity: minor + +## Rule 4.1.2-35 + +### Requirement + +>*The context is identified as a single TOC, but is split into multiple tags* + +### Error details + +Single TOC is tagged as multiple ones + +* Object type: `SATOC` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1006).length == 0` +* Severity: minor + +## Rule 4.1.2-36 + +### Requirement + +>*The number of tags in a structure element does not match the number of rows of the visual representation of this table* + +### Error details + +Invalid number of rows in a table + +* Object type: `SATable` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1104).length == 0` +* Severity: minor + +## Rule 4.1.2-37 + +### Requirement + +>*The number of columns in a
    structure element does not match the number of rows of the visual representation of this table* + +### Error details + +Invalid number of columns in a table + +* Object type: `SATable` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1105).length == 0` +* Severity: minor + +## Rule 4.1.2-38 + +### Requirement + +>*The row span of a
    or structure element (table cell) does not match the row span of the visual representation of this table cell* + +### Error details + +Invalid row span of a table cell + +* Object type: `SATableCell` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1106).length == 0` +* Severity: minor + +## Rule 4.1.2-39 + +### Requirement + +>*The column span of a or structure element (table cell) does not match the column span of the visual representation of this table cell* + +### Error details + +Invalid column span of a table cell + +* Object type: `SATableCell` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1107).length == 0` +* Severity: minor + +## Rule 4.1.2-40 + +### Requirement + +>*The content is recognized as a list item, but is not marked with
  • tag* + +### Error details + +Missing list item + +* Object type: `SAListItem` +* Test condition: `false` +* Severity: minor + +## Rule 4.1.2-41 + +### Requirement + +>*The content of a
  • or structure element (table cell) is located below than some of the table cells of the next table row* + +### Error details + +Table cell is lower than expected + +* Object type: `SATableCell` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1100).length == 0` +* Severity: minor + +## Rule 4.1.2-42 + +### Requirement + +>*The content of a or structure element (table cell) is located above than some of the table cells of the previous table row* + +### Error details + +Table cell is higher than expected + +* Object type: `SATableCell` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1101).length == 0` +* Severity: minor + +## Rule 4.1.2-43 + +### Requirement + +>*The content of a or structure element (table cell) is located to the right to some of the table cells of the next table column* + +### Error details + +Table cell is shifted right + +* Object type: `SATableCell` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1102).length == 0` +* Severity: minor + +## Rule 4.1.2-44 + +### Requirement + +>*The content of a or structure element (table cell) is located to the left to some of the table cells of the previous table column* + +### Error details + +Table cell is shifted left + +* Object type: `SATableCell` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1103).length == 0` +* Severity: minor + +## Rule 4.1.2-45 + +### Requirement + +>*This structure element is recognized as (regular table cell), but is tagged as (table header)* + +### Error details + +Invalid table header + +* Object type: `SATH` +* Test condition: `correctType != 'TD'` +* Severity: minor + +## Rule 4.1.2-46 + +### Requirement + +>*Table of Content item text does not match any heading in the document* + +### Error details + +TOC item text is not found in the document + +* Object type: `SATOCI` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1007).length == 0` +* Severity: major + +## Rule 4.1.2-47 + +### Requirement + +>*Table of Content item text is not found on the destination page* + +### Error details + +TOC item is not found on the destination page + +* Object type: `SATOCI` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1008).length == 0` +* Severity: major + +## Rule 4.1.2-48 + +### Requirement + +>*Table of Content item does not have an interactive link to the destination page* + +### Error details + +TOC item has no destination link + +* Object type: `SATOCI` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1009).length == 0` +* Severity: major + +## Rule 4.1.2-49 + +### Requirement + +>*Table of Content item has invalid page number (label)* + +### Error details + +Incorrect page number in TOC item + +* Object type: `SATOCI` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1010).length == 0` +* Severity: major + +## Rule 4.1.2-50 + +### Requirement + +>*Table of Content items numbering is inconsistent / does not follow any pattern* + +### Error details + +Inconsistent TOC item numbering + +* Object type: `SATOCI` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1011).length == 0` +* Severity: major + +## Rule 4.1.2-51 + +### Requirement + +>* (List) element has another element as its only immediate child* + +### Error details + +Single List inside List + +* Object type: `SAL` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1201).length == 0` +* Severity: minor + +## Rule 4.1.2-52 + +### Requirement + +>*Several list items are tagged as a single
  • element* + +### Error details + +Several List items are tagged as one + +* Object type: `SALI` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1202).length == 0` +* Severity: minor + +## Rule 4.1.2-53 + +### Requirement + +>*A part of the text is recognized as a Note, but tagged as element* + +### Error details + +Note is tagged as a Span + +* Object type: `SASpan` +* Test condition: `correctType != 'Note'` +* Severity: minor + +## Rule 4.1.2-54 + +### Requirement + +>*A part of the text is recognized as a Note, but tagged as

    element* + +### Error details + +Note is tagged as a Paragraph + +* Object type: `SAP` +* Test condition: `correctType != 'Note'` +* Severity: minor + +## Rule 4.1.2-55 + +### Requirement + +>*The heading is a single child of its ancestor structure element and is not grouped with the related content* + +### Error details + +The heading is not grouped with the related content + +* Object type: `SAStructElem` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1300).length == 0` +* Severity: minor + diff --git a/src/static/wiki_WCAG2.2_machine.md b/src/static/wiki_WCAG2.2_machine.md new file mode 100644 index 00000000..f43c15f4 --- /dev/null +++ b/src/static/wiki_WCAG2.2_machine.md @@ -0,0 +1,201 @@ +# WCAG2.2 validation rules +## Rule 1.3.1-1 + +### Requirement + +>*Repeated ASCII characters are used for presentational purpose and are not marked as artifact* + +### Error details + +ASCII text is used as a pseudographics + +* Object type: `SARepeatedCharacters` +* Test condition: `isNonSpace == false || numberOfRepeatedCharacters < 5` +* Severity: cosmetic + +## Rule 1.3.1-2 + +### Requirement + +>*Repeated SPACE characters are used for formatting purpose and are not marked as artifact* + +### Error details + +Space characters are used for formatting purpose + +* Object type: `SARepeatedCharacters` +* Test condition: `isNonSpace == true || numberOfRepeatedCharacters < 3` +* Severity: cosmetic + +## Rule 1.3.4-1 + +### Requirement + +>*Pages shall have the same orientation within the document unless specific display orientation is essential* + +### Error details + +Pages have different orientation + +* Object type: `PDPage` +* Test condition: `orientation == 'Square' || gMostCommonPageOrientation == orientation` +* Severity: minor + +## Rule 1.4.3-1 + +### Requirement + +>*The visual presentation of text and images of text has a contrast ratio of at least 4.5:1. Large-scale text and images of large-scale text have a contrast ratio of at least 3:1* + +### Error details + +Insufficient text contrast + +* Object type: `SATextChunk` +* Test condition: `textSize < 4.5 || ((textSize >= 18.0 || (textSize >= 14.0 && textWeight >= 700.0)) ? (contrastRatio >= 3) : (contrastRatio >= 4.5)) || parentsStandardTypes.split('&').filter(elem => elem == 'Figure').length > 0` +* Severity: major + +## Rule 1.4.4-1 + +### Requirement + +>*Text is too small and may not be resized without assistive technology up to 200 percent without loss of content or functionality* + +### Error details + +Text size is too small + +* Object type: `SATextChunk` +* Test condition: `textSize >= 4.5 || isWhiteSpaceChunk == true || parentsStandardTypes.split('&').filter(elem => elem == 'Figure').length > 0` +* Severity: major + +## Rule 1.4.10-1 + +### Requirement + +>*Bounding box should be present for a figure appearing in its entirety on a single page to indicate the area of the figure on the page* + +### Error details + +Figure has no BBox attribute + +* Object type: `SAFigure` +* Test condition: `page != lastPage || hasBBox == true` +* Severity: minor +* Additional references: + * ISO 32000-1:2008, 14.8.5.4.3 + +## Rule 2.4.9-1 + +### Requirement + +>*The Link annotation has no Alt entry and is not associated with a meaningful text on the page* + +### Error details + +Missing alternate Link description + +* Object type: `SALinkAnnotation` +* Test condition: `(Contents != null && Contents != '' && contentsIsLink == false) || isOutsideCropBox == true || (F & 2) == 2 || (textValue != null && textValue != '' && textValueIsLink == false) || (Alt != null && Alt != '' && altIsLink == false)` +* Severity: major +* Additional references: + * ISO 32000-1:2008, 14.9.3 + +## Rule 4.1.1-1 + +### Requirement + +>*Merged table cells deteriorate the document accessibility and are not recommended* + +### Error details + +Table body contains merged cells + +* Object type: `SETD` +* Test condition: `ColSpan == 1 && RowSpan == 1` +* Severity: cosmetic + +## Rule 4.1.1-2 + +### Requirement + +>*Merged table cells deteriorate the document accessibility and are not recommended* + +### Error details + +Table header contains merged cells + +* Object type: `SETH` +* Test condition: `ColSpan == 1 && RowSpan == 1` +* Severity: cosmetic + +## Rule 4.1.2-16 + +### Requirement + +>*Paragraph structure element has no real content* + +### Error details + +Paragraph structure element is empty + +* Object type: `SAP` +* Test condition: `correctType != null` +* Severity: minor + +## Rule 4.1.2-17 + +### Requirement + +>*Span structure element has no real content* + +### Error details + +Span structure element is empty + +* Object type: `SASpan` +* Test condition: `correctType != null` +* Severity: minor + +## Rule 4.1.2-18 + +### Requirement + +>*Heading structure element has no real content* + +### Error details + +Heading structure element is empty + +* Object type: `SAH` +* Test condition: `correctType != null` +* Severity: minor + +## Rule 4.1.2-19 + +### Requirement + +>*Numbered heading structure element has no real content* + +### Error details + +Numbered heading structure element is empty + +* Object type: `SAHn` +* Test condition: `correctType != null` +* Severity: minor + +## Rule 4.1.2-29 + +### Requirement + +>* structure element (Table of Content item) contains no text* + +### Error details + +Empty TOC item + +* Object type: `SATOCI` +* Test condition: `errorCodes.split(',').filter(elem => elem == 1000).length == 0` +* Severity: minor +