Skip to content

Commit 00afe74

Browse files
adamchaborykrichard67QuyTonlaoneo
authored
[5.3] Update Jooa11y to Sa11y 4.0.3 (#44813)
* Update Jooa11y to Sa11y 4.0.3 - Updated Sa11y from 3.1.3 to 4.0.3 - Removed the following setting fields: Contrast, Form Labels, Links (Advanced), Colour Filter, Web Components to Check, Additional Checks Always On - Unused language strings moved to end of file (to be removed with 6.0) - Introduced new "Turn Off Checks" field, where admins can turn off specific checks within Sa11y by key name. * Indent to 4 spaces as per joomla coding standards * Update plugins/system/jooa11y/src/Extension/Jooa11y.php Co-authored-by: Richard Fath <[email protected]> * Update plugins/system/jooa11y/src/Extension/Jooa11y.php Co-authored-by: Richard Fath <[email protected]> * Update plugins/system/jooa11y/src/Extension/Jooa11y.php Co-authored-by: Richard Fath <[email protected]> * Update package-lock.json * Update plugins/system/jooa11y/src/Extension/Jooa11y.php * Update plugins/system/jooa11y/jooa11y.xml * Update plg_system_jooa11y.ini * Update administrator/language/en-GB/plg_system_jooa11y.ini * Update plugins/system/jooa11y/src/Extension/Jooa11y.php * Update package.json --------- Co-authored-by: Richard Fath <[email protected]> Co-authored-by: Quy Ton <[email protected]> Co-authored-by: Allon Moritz <[email protected]>
1 parent 96c6887 commit 00afe74

File tree

5 files changed

+74
-109
lines changed

5 files changed

+74
-109
lines changed

administrator/language/en-GB/plg_system_jooa11y.ini

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,36 @@
44
; Note : All ini files need to be saved as UTF-8
55

66
PLG_SYSTEM_JOOA11Y="System - Joomla Accessibility Checker"
7-
PLG_SYSTEM_JOOA11Y_FIELD_ADDITIONAL_CHECKS="Additional Checks Always On"
8-
PLG_SYSTEM_JOOA11Y_FIELD_ADDITIONAL_CHECKS_DESC="Enabling this option will visually hide the toggle switches for Form Labels, Contrast, Links (Advanced) in the Settings panel."
7+
PLG_SYSTEM_JOOA11Y_XML_DESCRIPTION="The Joomla Accessibility Checker visually highlights common accessibility and usability issues. Geared towards content authors, the plugin identifies errors or warnings and provides guidance on how to fix them. Please be aware that this plugin does not offer an exhaustive analysis of your website, nor does it automatically ensure your website's accessibility. It's important to select a template that is inherently accessible to ensure your site meets accessibility standards."
8+
PLG_SYSTEM_JOOA11Y_KEY="Key"
9+
PLG_SYSTEM_JOOA11Y_VALUE="Value"
10+
PLG_SYSTEM_JOOA11Y_FIELD_SHOW_ALWAYS="Show Always"
11+
PLG_SYSTEM_JOOA11Y_FIELD_SHOW_ALWAYS_DESC="Load the accessibility checker on all pages. This is useful when developing the website, but should not be left on when the website is live."
912
PLG_SYSTEM_JOOA11Y_FIELD_CHECK_ROOT="Target Area to Check"
1013
PLG_SYSTEM_JOOA11Y_FIELD_CHECK_ROOT_DESC="Input a single selector to target a specific region of your website. The default setting is the landmark <strong>main</strong>. Alternatives to landmarks are classes, elements or ARIA roles (e.g. #main-content, .main, [role='main']). Input <strong>body</strong> to check the entire page."
11-
PLG_SYSTEM_JOOA11Y_FIELD_COLOUR_FILTER="Colour Filter"
12-
PLG_SYSTEM_JOOA11Y_FIELD_COLOUR_FILTER_DESC="Show Colour Filter toggle in Settings panel. Colour filters help identify colour combinations that may be difficult for people to distinguish."
1314
PLG_SYSTEM_JOOA11Y_FIELD_CONTAINER_IGNORE="Ignore Regions"
1415
PLG_SYSTEM_JOOA11Y_FIELD_CONTAINER_IGNORE_DESC="Ignore specific regions within the Content Container. Use commas to separate classes or elements (eg #ignore, .ignore)."
16+
PLG_SYSTEM_JOOA11Y_FIELD_READABILITY_ROOT="Readability Target Area"
17+
PLG_SYSTEM_JOOA11Y_FIELD_READABILITY_ROOT_DESC="Landmark on the page that will be checked for readability. The default setting is the landmark <strong>main</strong>."
18+
PLG_SYSTEM_JOOA11Y_FIELD_EXTRA_PROPS="Extra Properties"
19+
PLG_SYSTEM_JOOA11Y_FIELD_EXTRA_PROPS_DESC="Pass additional properties to customise. Learn how to add <a href=\"https://sa11y.netlify.app/joomla/#extra-properties\" target=\"_blank\" rel=\"noopener noreferrer\">Extra Properties</a>."
20+
PLG_SYSTEM_JOOA11Y_FIELD_CHECKS="Turn Off Checks"
21+
PLG_SYSTEM_JOOA11Y_FIELD_CHECKS_DESC="Turn off specific checks by key name. Learn how to <a href=\"https://sa11y.netlify.app/joomla/#turn-off-checks\" target=\"_blank\" rel=\"noopener noreferrer\">Turn Off Checks</a>."
22+
23+
24+
; All the following strings are deprecated and will be removed with 6.0
25+
PLG_SYSTEM_JOOA11Y_FIELD_WEB_COMPONENTS="Web Components to Check"
26+
PLG_SYSTEM_JOOA11Y_FIELD_WEB_COMPONENTS_DESC="Provide a list of all known web components or containers with an open shadow DOM."
27+
PLG_SYSTEM_JOOA11Y_FIELD_COLOUR_FILTER="Colour Filter"
28+
PLG_SYSTEM_JOOA11Y_FIELD_COLOUR_FILTER_DESC="Show Colour Filter toggle in Settings panel. Colour filters help identify colour combinations that may be difficult for people to distinguish."
29+
PLG_SYSTEM_JOOA11Y_FIELD_ADDITIONAL_CHECKS="Additional Checks Always On"
30+
PLG_SYSTEM_JOOA11Y_FIELD_ADDITIONAL_CHECKS_DESC="Enabling this option will visually hide the toggle switches for Form Labels, Contrast, Links (Advanced) in the Settings panel."
1531
PLG_SYSTEM_JOOA11Y_FIELD_CONTRAST="Contrast"
1632
PLG_SYSTEM_JOOA11Y_FIELD_CONTRAST_DESC="Show Contrast toggle in Settings panel. Check for WCAG 2.0 Level AA contrast issues between foreground text and background elements."
17-
PLG_SYSTEM_JOOA11Y_FIELD_EXTRA_PROPS="Extra Properties"
18-
PLG_SYSTEM_JOOA11Y_FIELD_EXTRA_PROPS_DESC="Pass additional properties to customise. Provide a valid key/value pair. Refer to <a href=\"https://sa11y.netlify.app/developers/props/\" target=\"_blank\" rel=\"noopener noreferrer\">documentation</a>."
1933
PLG_SYSTEM_JOOA11Y_FIELD_FORM_LABELS="Form Labels"
2034
PLG_SYSTEM_JOOA11Y_FIELD_FORM_LABELS_DESC="Show Form Labels toggle in Settings panel. Check for form inputs missing a corresponding label. Not necessarily a content author issue, and usually not an issue when using a reputable, accessible forms plugin."
2135
PLG_SYSTEM_JOOA11Y_FIELD_LINKS_ADVANCED="Links (Advanced)"
2236
PLG_SYSTEM_JOOA11Y_FIELD_LINKS_ADVANCED_DESC="Show Links (Advanced) toggle in Settings panel. Check for additional issues such as: links that open in a new tab without warning, have identical names but different purpose, or points to a PDF and other files without warning."
23-
PLG_SYSTEM_JOOA11Y_FIELD_READABILITY_ROOT="Readability Target Area"
24-
PLG_SYSTEM_JOOA11Y_FIELD_READABILITY_ROOT_DESC="Landmark on the page that will be checked for readability. The default setting is the landmark <strong>main</strong>."
25-
PLG_SYSTEM_JOOA11Y_FIELD_SHOW_ALWAYS="Show Always"
26-
PLG_SYSTEM_JOOA11Y_FIELD_SHOW_ALWAYS_DESC="Load the accessibility checker on all pages. This is useful when developing the website, but should not be left on when the website is live."
27-
PLG_SYSTEM_JOOA11Y_FIELD_WEB_COMPONENTS="Web Components to Check"
28-
PLG_SYSTEM_JOOA11Y_FIELD_WEB_COMPONENTS_DESC="Provide a list of all known web components or containers with an open shadow DOM."
29-
PLG_SYSTEM_JOOA11Y_KEY="Key"
30-
PLG_SYSTEM_JOOA11Y_VALUE="Value"
31-
PLG_SYSTEM_JOOA11Y_XML_DESCRIPTION="The Joomla Accessibility Checker visually highlights common accessibility and usability issues. Geared towards content authors, the plugin identifies errors or warnings and provides guidance on how to fix them. Please be aware that this plugin does not offer an exhaustive analysis of your website, nor does it automatically ensure your website's accessibility. It's important to select a template that is inherently accessible to ensure your site meets accessibility standards."
32-
33-
; All the following strings are deprecated and will be removed with 6.0
3437
PLG_SYSTEM_JOOA11Y_ALERT_CLOSE="Close"
3538
PLG_SYSTEM_JOOA11Y_ALERT_TEXT="Alert"
3639
PLG_SYSTEM_JOOA11Y_CONTAINER_LABEL="Accessibility Checker"

package-lock.json

Lines changed: 20 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"punycode": "^2.3.1",
7878
"qrcode-generator": "^1.4.4",
7979
"roboto-fontface": "^0.10.0",
80-
"sa11y": "^3.1.3",
80+
"sa11y": "^4.0.3",
8181
"shepherd.js": "^11.2.0",
8282
"short-and-sweet": "^1.0.4",
8383
"skipto": "^4.1.7",

plugins/system/jooa11y/jooa11y.xml

Lines changed: 12 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -33,66 +33,6 @@
3333
<option value="0">JOFF</option>
3434
<option value="1">JON</option>
3535
</field>
36-
<field
37-
name="contrastPlugin"
38-
type="radio"
39-
label="PLG_SYSTEM_JOOA11Y_FIELD_CONTRAST"
40-
description="PLG_SYSTEM_JOOA11Y_FIELD_CONTRAST_DESC"
41-
layout="joomla.form.field.radio.switcher"
42-
default="1"
43-
filter="integer"
44-
>
45-
<option value="0">JOFF</option>
46-
<option value="1">JON</option>
47-
</field>
48-
<field
49-
name="formLabelsPlugin"
50-
type="radio"
51-
label="PLG_SYSTEM_JOOA11Y_FIELD_FORM_LABELS"
52-
description="PLG_SYSTEM_JOOA11Y_FIELD_FORM_LABELS_DESC"
53-
layout="joomla.form.field.radio.switcher"
54-
default="1"
55-
filter="integer"
56-
>
57-
<option value="0">JOFF</option>
58-
<option value="1">JON</option>
59-
</field>
60-
<field
61-
name="linksAdvancedPlugin"
62-
type="radio"
63-
label="PLG_SYSTEM_JOOA11Y_FIELD_LINKS_ADVANCED"
64-
description="PLG_SYSTEM_JOOA11Y_FIELD_LINKS_ADVANCED_DESC"
65-
layout="joomla.form.field.radio.switcher"
66-
default="1"
67-
filter="integer"
68-
>
69-
<option value="0">JOFF</option>
70-
<option value="1">JON</option>
71-
</field>
72-
<field
73-
name="colourFilterPlugin"
74-
type="radio"
75-
label="PLG_SYSTEM_JOOA11Y_FIELD_COLOUR_FILTER"
76-
description="PLG_SYSTEM_JOOA11Y_FIELD_COLOUR_FILTER_DESC"
77-
layout="joomla.form.field.radio.switcher"
78-
default="1"
79-
filter="integer"
80-
>
81-
<option value="0">JOFF</option>
82-
<option value="1">JON</option>
83-
</field>
84-
<field
85-
name="additionalChecks"
86-
type="radio"
87-
label="PLG_SYSTEM_JOOA11Y_FIELD_ADDITIONAL_CHECKS"
88-
description="PLG_SYSTEM_JOOA11Y_FIELD_ADDITIONAL_CHECKS_DESC"
89-
layout="joomla.form.field.radio.switcher"
90-
default="0"
91-
filter="integer"
92-
>
93-
<option value="0">JOFF</option>
94-
<option value="1">JON</option>
95-
</field>
9636
<field
9737
name="checkRoot"
9838
type="text"
@@ -116,13 +56,6 @@
11656
description="PLG_SYSTEM_JOOA11Y_FIELD_CONTAINER_IGNORE_DESC"
11757
filter="string"
11858
/>
119-
<field
120-
name="shadowComponents"
121-
type="text"
122-
label="PLG_SYSTEM_JOOA11Y_FIELD_WEB_COMPONENTS"
123-
description="PLG_SYSTEM_JOOA11Y_FIELD_WEB_COMPONENTS_DESC"
124-
filter="string"
125-
/>
12659
<field
12760
name="extraProps"
12861
type="subform"
@@ -135,6 +68,18 @@
13568
<field type="text" name="value" label="PLG_SYSTEM_JOOA11Y_VALUE"/>
13669
</form>
13770
</field>
71+
<field
72+
name="checks"
73+
type="subform"
74+
label="PLG_SYSTEM_JOOA11Y_FIELD_CHECKS"
75+
description="PLG_SYSTEM_JOOA11Y_FIELD_CHECKS_DESC"
76+
multiple="true"
77+
>
78+
<form>
79+
<field type="text" name="key" label="PLG_SYSTEM_JOOA11Y_KEY"/>
80+
<field type="text" name="value" label="PLG_SYSTEM_JOOA11Y_VALUE"/>
81+
</form>
82+
</field>
13883
</fieldset>
13984
</fields>
14085
</config>

plugins/system/jooa11y/src/Extension/Jooa11y.php

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -181,32 +181,33 @@ public function addJooa11y()
181181

182182
// Get plugin options from xml
183183
$getOptions = [
184-
'checkRoot' => $this->params->get('checkRoot', 'main'),
185-
'readabilityRoot' => $this->params->get('readabilityRoot', 'main'),
186-
'containerIgnore' => $this->params->get('containerIgnore'),
187-
'contrastPlugin' => $this->params->get('contrastPlugin', 1),
188-
'formLabelsPlugin' => $this->params->get('formLabelsPlugin', 1),
189-
'linksAdvancedPlugin' => $this->params->get('linksAdvancedPlugin', 1),
190-
'colourFilterPlugin' => $this->params->get('colourFilterPlugin', 1),
191-
'checkAllHideToggles' => $this->params->get('additionalChecks', 0),
192-
'shadowComponents' => $this->params->get('shadowComponents'),
184+
'checkRoot' => $this->params->get('checkRoot', 'main'),
185+
'readabilityRoot' => $this->params->get('readabilityRoot', 'main'),
186+
'containerIgnore' => $this->params->get('containerIgnore'),
193187
];
194188
$getExtraProps = $this->params->get('extraProps', []);
195-
196-
197-
// Process extra props
198-
$extraProps = [];
199-
foreach ($getExtraProps as $prop) {
200-
$decodedValue = json_decode($prop->value);
201-
if (is_numeric($decodedValue) || \is_bool($decodedValue)) {
202-
$extraProps[$prop->key] = $decodedValue;
203-
} else {
204-
$extraProps[$prop->key] = "{$prop->value}";
189+
$getChecks = $this->params->get('checks', []);
190+
191+
// Process Sa11y's props
192+
function processProps($props)
193+
{
194+
$result = [];
195+
foreach ($props as $prop) {
196+
$decodedValue = json_decode($prop->value);
197+
if (is_numeric($decodedValue) || \is_bool($decodedValue)) {
198+
$result[$prop->key] = $decodedValue;
199+
} else {
200+
$result[$prop->key] = "{$prop->value}";
201+
}
205202
}
203+
return $result;
206204
}
205+
$extraProps = processProps($getExtraProps);
206+
$checks = processProps($getChecks);
207+
$allChecks = ['checks' => $checks];
207208

208209
// Merge all options together and add to page
209-
$allOptions = array_merge($getOptions, $extraProps);
210+
$allOptions = array_merge($getOptions, $extraProps, $allChecks);
210211
$document->addScriptOptions('jooa11yOptions', $allOptions);
211212

212213
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa*/

0 commit comments

Comments
 (0)