diff --git a/lib/editor/atto/plugins/accessibilitychecker/lang/en/atto_accessibilitychecker.php b/lib/editor/atto/plugins/accessibilitychecker/lang/en/atto_accessibilitychecker.php
index fdd3df14cb2..0b156de8606 100644
--- a/lib/editor/atto/plugins/accessibilitychecker/lang/en/atto_accessibilitychecker.php
+++ b/lib/editor/atto/plugins/accessibilitychecker/lang/en/atto_accessibilitychecker.php
@@ -23,6 +23,7 @@
*/
$string['emptytext'] = 'Empty text';
+$string['entiredocument'] = 'Entire document';
$string['imagesmissingalt'] = 'Images require alternative text. To fix this warning, add an alt attribute to your img tags. An empty alt attribute may be used, but only when the image is purely decorative and carries no information.';
$string['needsmorecontrast'] = 'The colours of the foreground and background text do not have enough contrast. To fix this warning, change either foreground or background colour of the text so that it is easier to read.';
$string['needsmoreheadings'] = 'There is a lot of text with no headings. Headings will allow screen reader users to navigate through the page easily and will make the page more usable for everyone.';
diff --git a/lib/editor/atto/plugins/accessibilitychecker/lib.php b/lib/editor/atto/plugins/accessibilitychecker/lib.php
index 6bc3645817d..bd14a7f3cfb 100644
--- a/lib/editor/atto/plugins/accessibilitychecker/lib.php
+++ b/lib/editor/atto/plugins/accessibilitychecker/lib.php
@@ -39,6 +39,7 @@ function atto_accessibilitychecker_strings_for_js() {
'tableswithmergedcells',
'tablesmissingcaption',
'emptytext',
+ 'entiredocument',
'tablesmissingheaders'),
'atto_accessibilitychecker');
}
diff --git a/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-debug.js b/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-debug.js
index 65474355a5c..84699a1952b 100644
--- a/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-debug.js
+++ b/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-debug.js
@@ -179,7 +179,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
problemNodes = [];
this.editor.all('table').each(function (table) {
caption = table.one('caption');
- if (caption === null) {
+ if (caption === null || caption.get('text').trim() === '') {
problemNodes.push(table);
}
}, this);
@@ -201,7 +201,8 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
if (table.one('tr').one('td')) {
// First row has a non-header cell, so all rows must have at least one header.
table.all('tr').some(function (row) {
- if (!row.one('th')) {
+ var header = row.one('th');
+ if (!header || (header.get('text').trim() === '')) {
problemNodes.push(table);
return true;
}
@@ -209,7 +210,16 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
}, this);
} else {
// First row must have at least one header then.
- if (!table.one('tr').one('th')) {
+ var hasHeader = false;
+ table.one('tr').all('th').some(function (header) {
+ hasHeader = true;
+ if (header.get('text').trim() === '') {
+ problemNodes.push(table);
+ return true;
+ }
+ return false;
+ });
+ if (!hasHeader) {
problemNodes.push(table);
}
}
@@ -251,6 +261,9 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
if (text === '') {
text = M.util.get_string('emptytext', COMPONENT);
}
+ if (nodes[i] === this.editor) {
+ text = M.util.get_string('entiredocument', COMPONENT);
+ }
link = Y.Node.create('' + text + '');
}
link.setData('sourceNode', nodes[i]);
diff --git a/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-min.js b/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-min.js
index 2418607287d..59a10f7315d 100644
--- a/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-min.js
+++ b/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-min.js
@@ -1 +1 @@
-YUI.add("moodle-atto_accessibilitychecker-button",function(e,t){var n="atto_accessibilitychecker";e.namespace("M.atto_accessibilitychecker").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addButton({icon:"e/accessibility_checker",callback:this._displayDialogue})},_displayDialogue:function(){var e=this.getDialogue({headerContent:M.util.get_string("pluginname",n),width:"500px",focusAfterHide:!0});e.set("bodyContent",this._getDialogueContent()).show()},_getDialogueContent:function(){var t=e.Node.create('
');return t.append(this._getWarnings()),t.delegate("click",function(e){e.preventDefault();var t=this.get("host"),n=e.currentTarget.getData("sourceNode"),r=this.getDialogue();n?(r.set("focusAfterHide",this.editor).hide(),t.setSelection(t.getSelectionFromNode(n))):r.hide()},"a",this),t},_getWarnings:function(){var t,r=e.Node.create("");return t=[],this.editor.all("img").each(function(e){alt=e.getAttribute("alt"),(typeof alt=="undefined"||alt==="")&&e.getAttribute("role")!=="presentation"&&t.push(e)},this),this._addWarnings(r,M.util.get_string("imagesmissingalt",n),t,!0),t=[],this.editor.all("*").each(function(n){var r,i,s,o,u;if(e.Lang.trim(n.get("text"))!==""){r=n.getComputedStyle("color"),i=n.getComputedStyle("backgroundColor"),o=this._getLuminanceFromCssColor(r),u=this._getLuminanceFromCssColor(i),o>u?s=(o+.05)/(u+.05):s=(u+.05)/(o+.05);if(s<=4.5){var a=0,f=!1;for(a=0;a1e3&&!this.editor.one("h3, h4, h5")&&this._addWarnings(r,M.util.get_string("needsmoreheadings",n),[this.editor],!1),t=[],this.editor.all("table").each(function(e){caption=e.one("caption"),caption===null&&t.push(e)},this),this._addWarnings(r,M.util.get_string("tablesmissingcaption",n),t,!1),t=[],this.editor.all("table").each(function(e){caption=e.one("[colspan],[rowspan]"),caption!==null&&t.push(e)},this),this._addWarnings(r,M.util.get_string("tableswithmergedcells",n),t,!1),t=[],this.editor.all("table").each(function(e){e.one("tr").one("td")?e.all("tr").some(function(n){return n.one("th")?!1:(t.push(e),!0)},this):e.one("tr").one("th")||t.push(e)},this),this._addWarnings(r,M.util.get_string("tablesmissingheaders",n),t,!1),r.hasChildNodes()||r.append(""+M.util.get_string("nowarnings",n)+"
"),r},_addWarnings:function(t,r,i,s){var o,u,a,f,l,c,h,p;if(i.length>0){o=e.Node.create(""+r+"
"),u=e.Node.create('
'),a=0;for(a=0;a"),s?(f=i[a].getAttribute("src"),h=e.Node.create('
'+f+"")):(l="innerText"in i[a]?"innerText":"textContent",p=i[a].get(l).trim(),p===""&&(p=M.util.get_string("emptytext",n)),h=e.Node.create(''+p+"")),h.setData("sourceNode",i[a]),c.append(h),u.append(c);o.append(u),t.append(o)}},_getLuminanceFromCssColor:function(t){var n;t==="transparent"&&(t="#ffffff"),n=e.Color.toArray(e.Color.toRGB(t));var r=function(e){return e=parseInt(e,10)/255,e<=.03928?e/=12.92:e=Math.pow((e+.055)/1.055,2.4),e},i=r(n[0]),s=r(n[1]),o=r(n[2]);return.2126*i+.7152*s+.0722*o}})},"@VERSION@",{requires:["color-base","moodle-editor_atto-plugin"]});
+YUI.add("moodle-atto_accessibilitychecker-button",function(e,t){var n="atto_accessibilitychecker";e.namespace("M.atto_accessibilitychecker").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addButton({icon:"e/accessibility_checker",callback:this._displayDialogue})},_displayDialogue:function(){var e=this.getDialogue({headerContent:M.util.get_string("pluginname",n),width:"500px",focusAfterHide:!0});e.set("bodyContent",this._getDialogueContent()).show()},_getDialogueContent:function(){var t=e.Node.create('');return t.append(this._getWarnings()),t.delegate("click",function(e){e.preventDefault();var t=this.get("host"),n=e.currentTarget.getData("sourceNode"),r=this.getDialogue();n?(r.set("focusAfterHide",this.editor).hide(),t.setSelection(t.getSelectionFromNode(n))):r.hide()},"a",this),t},_getWarnings:function(){var t,r=e.Node.create("");return t=[],this.editor.all("img").each(function(e){alt=e.getAttribute("alt"),(typeof alt=="undefined"||alt==="")&&e.getAttribute("role")!=="presentation"&&t.push(e)},this),this._addWarnings(r,M.util.get_string("imagesmissingalt",n),t,!0),t=[],this.editor.all("*").each(function(n){var r,i,s,o,u;if(e.Lang.trim(n.get("text"))!==""){r=n.getComputedStyle("color"),i=n.getComputedStyle("backgroundColor"),o=this._getLuminanceFromCssColor(r),u=this._getLuminanceFromCssColor(i),o>u?s=(o+.05)/(u+.05):s=(u+.05)/(o+.05);if(s<=4.5){var a=0,f=!1;for(a=0;a1e3&&!this.editor.one("h3, h4, h5")&&this._addWarnings(r,M.util.get_string("needsmoreheadings",n),[this.editor],!1),t=[],this.editor.all("table").each(function(e){caption=e.one("caption"),(caption===null||caption.get("text").trim()==="")&&t.push(e)},this),this._addWarnings(r,M.util.get_string("tablesmissingcaption",n),t,!1),t=[],this.editor.all("table").each(function(e){caption=e.one("[colspan],[rowspan]"),caption!==null&&t.push(e)},this),this._addWarnings(r,M.util.get_string("tableswithmergedcells",n),t,!1),t=[],this.editor.all("table").each(function(e){if(e.one("tr").one("td"))e.all("tr").some(function(n){var r=n.one("th");return!r||r.get("text").trim()===""?(t.push(e),!0):!1},this);else{var n=!1;e.one("tr").all("th").some(function(r){return n=!0,r.get("text").trim()===""?(t.push(e),!0):!1}),n||t.push(e)}},this),this._addWarnings(r,M.util.get_string("tablesmissingheaders",n),t,!1),r.hasChildNodes()||r.append(""+M.util.get_string("nowarnings",n)+"
"),r},_addWarnings:function(t,r,i,s){var o,u,a,f,l,c,h,p;if(i.length>0){o=e.Node.create(""+r+"
"),u=e.Node.create('
'),a=0;for(a=0;a"),s?(f=i[a].getAttribute("src"),h=e.Node.create('
'+f+"")):(l="innerText"in i[a]?"innerText":"textContent",p=i[a].get(l).trim(),p===""&&(p=M.util.get_string("emptytext",n)),i[a]===this.editor&&(p=M.util.get_string("entiredocument",n)),h=e.Node.create(''+p+"")),h.setData("sourceNode",i[a]),c.append(h),u.append(c);o.append(u),t.append(o)}},_getLuminanceFromCssColor:function(t){var n;t==="transparent"&&(t="#ffffff"),n=e.Color.toArray(e.Color.toRGB(t));var r=function(e){return e=parseInt(e,10)/255,e<=.03928?e/=12.92:e=Math.pow((e+.055)/1.055,2.4),e},i=r(n[0]),s=r(n[1]),o=r(n[2]);return.2126*i+.7152*s+.0722*o}})},"@VERSION@",{requires:["color-base","moodle-editor_atto-plugin"]});
diff --git a/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button.js b/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button.js
index 7fd2b0b1a0a..bf346bb767e 100644
--- a/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button.js
+++ b/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button.js
@@ -174,7 +174,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
problemNodes = [];
this.editor.all('table').each(function (table) {
caption = table.one('caption');
- if (caption === null) {
+ if (caption === null || caption.get('text').trim() === '') {
problemNodes.push(table);
}
}, this);
@@ -196,7 +196,8 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
if (table.one('tr').one('td')) {
// First row has a non-header cell, so all rows must have at least one header.
table.all('tr').some(function (row) {
- if (!row.one('th')) {
+ var header = row.one('th');
+ if (!header || (header.get('text').trim() === '')) {
problemNodes.push(table);
return true;
}
@@ -204,7 +205,16 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
}, this);
} else {
// First row must have at least one header then.
- if (!table.one('tr').one('th')) {
+ var hasHeader = false;
+ table.one('tr').all('th').some(function (header) {
+ hasHeader = true;
+ if (header.get('text').trim() === '') {
+ problemNodes.push(table);
+ return true;
+ }
+ return false;
+ });
+ if (!hasHeader) {
problemNodes.push(table);
}
}
@@ -246,6 +256,9 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
if (text === '') {
text = M.util.get_string('emptytext', COMPONENT);
}
+ if (nodes[i] === this.editor) {
+ text = M.util.get_string('entiredocument', COMPONENT);
+ }
link = Y.Node.create('' + text + '');
}
link.setData('sourceNode', nodes[i]);
diff --git a/lib/editor/atto/plugins/accessibilitychecker/yui/src/button/js/button.js b/lib/editor/atto/plugins/accessibilitychecker/yui/src/button/js/button.js
index 3aa5e5b2d80..67b3878bc59 100644
--- a/lib/editor/atto/plugins/accessibilitychecker/yui/src/button/js/button.js
+++ b/lib/editor/atto/plugins/accessibilitychecker/yui/src/button/js/button.js
@@ -177,7 +177,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
problemNodes = [];
this.editor.all('table').each(function (table) {
caption = table.one('caption');
- if (caption === null) {
+ if (caption === null || caption.get('text').trim() === '') {
problemNodes.push(table);
}
}, this);
@@ -199,7 +199,8 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
if (table.one('tr').one('td')) {
// First row has a non-header cell, so all rows must have at least one header.
table.all('tr').some(function (row) {
- if (!row.one('th')) {
+ var header = row.one('th');
+ if (!header || (header.get('text').trim() === '')) {
problemNodes.push(table);
return true;
}
@@ -207,7 +208,16 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
}, this);
} else {
// First row must have at least one header then.
- if (!table.one('tr').one('th')) {
+ var hasHeader = false;
+ table.one('tr').all('th').some(function (header) {
+ hasHeader = true;
+ if (header.get('text').trim() === '') {
+ problemNodes.push(table);
+ return true;
+ }
+ return false;
+ });
+ if (!hasHeader) {
problemNodes.push(table);
}
}
@@ -249,6 +259,9 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
if (text === '') {
text = M.util.get_string('emptytext', COMPONENT);
}
+ if (nodes[i] === this.editor) {
+ text = M.util.get_string('entiredocument', COMPONENT);
+ }
link = Y.Node.create('' + text + '');
}
link.setData('sourceNode', nodes[i]);