diff --git a/package-lock.json b/package-lock.json index d882989..bb8f7f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3121,6 +3121,30 @@ "@xtuc/long": "4.2.2" } }, + "@wordpress/a11y": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@wordpress/a11y/-/a11y-2.7.0.tgz", + "integrity": "sha512-slmpj1Dyb8oGkDRkmfkvR/KOvRMTvRFuc/yMk7omuNspj4MsLimKhpQnu16NycelC6IGg+Rzp/6ziYIAMi/1sw==", + "requires": { + "@babel/runtime": "^7.8.3", + "@wordpress/dom-ready": "^2.7.0" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.9.2.tgz", + "integrity": "sha512-NE2DtOdufG7R5vnfQUTehdTfNycfUANEtCa9PssN9O/xmTzP4E08UI797ixaei6hBEVL9BI/PsdJS5x7mWoB9Q==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "regenerator-runtime": { + "version": "0.13.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", + "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==" + } + } + }, "@wordpress/babel-plugin-import-jsx-pragma": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/@wordpress/babel-plugin-import-jsx-pragma/-/babel-plugin-import-jsx-pragma-2.5.0.tgz", @@ -4077,6 +4101,29 @@ "webpack-sources": "^1.3.0" } }, + "@wordpress/dom-ready": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@wordpress/dom-ready/-/dom-ready-2.7.0.tgz", + "integrity": "sha512-YTx/M3hpF4hJx5xFE5eECUalruIl/xvW8mJaqDRqCL22ktVDpWwyUtQkHtiVkNi2B8lYln8y57CB4q+7R3xIwg==", + "requires": { + "@babel/runtime": "^7.8.3" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.9.2.tgz", + "integrity": "sha512-NE2DtOdufG7R5vnfQUTehdTfNycfUANEtCa9PssN9O/xmTzP4E08UI797ixaei6hBEVL9BI/PsdJS5x7mWoB9Q==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "regenerator-runtime": { + "version": "0.13.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", + "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==" + } + } + }, "@wordpress/element": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-2.11.0.tgz", diff --git a/package.json b/package.json index 8c83f0a..a364a0a 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ }, "dependencies": { "@platform-coop-toolkit/pinecone": "^1.0.0-alpha.11", + "@wordpress/a11y": "^2.7.0", "cookies.js": "^2.1.15" }, "devDependencies": { diff --git a/resources/assets/scripts/routes/archive.js b/resources/assets/scripts/routes/archive.js index d17e19a..ec8ea82 100644 --- a/resources/assets/scripts/routes/archive.js +++ b/resources/assets/scripts/routes/archive.js @@ -4,6 +4,7 @@ import addNotification from '../util/addNotification'; import Cookies from 'cookies.js'; import Pinecone from '@platform-coop-toolkit/pinecone'; import { __, sprintf } from '@wordpress/i18n'; +import { speak } from '@wordpress/a11y'; export default { init() { @@ -20,6 +21,11 @@ export default { if ( 0 < deselectButtons.length ) { Array.prototype.forEach.call( deselectButtons, btn => { new Pinecone.DeselectAll( btn ); + const filterGroup = btn.parentNode.parentNode; + const filterGroupLabel = filterGroup.firstElementChild.textContent; + btn.onclick = () => { + speak(sprintf(__('All %s have been deselected', 'coop-library'), filterGroupLabel)); + } } ); } diff --git a/resources/assets/scripts/util/addNotification.js b/resources/assets/scripts/util/addNotification.js index dfeb913..649d75c 100644 --- a/resources/assets/scripts/util/addNotification.js +++ b/resources/assets/scripts/util/addNotification.js @@ -1,4 +1,5 @@ import { __ } from '@wordpress/i18n'; +import { speak } from '@wordpress/a11y'; /** * Add a notification. @@ -26,7 +27,7 @@ export default (title, content, type) => { } const alert = ` -
${icon} ${title}
@@ -34,8 +35,12 @@ export default (title, content, type) => {