diff --git a/assets/scripts/customizer-a11y.js b/assets/scripts/customizer-a11y.js deleted file mode 100644 index f5b3feb..0000000 --- a/assets/scripts/customizer-a11y.js +++ /dev/null @@ -1,55 +0,0 @@ -const { __ } = wp.i18n - -document.addEventListener( 'DOMContentLoaded', function () { - - function addAttribute( selector, att, val ){ - let e = document.querySelectorAll( selector ); - for ( let i=0; i < e.length; i++ ) { - e[ i ].setAttribute( att, val ); - } - } - - // Add aria-label attribute to color picker slider - // https://github.com/Automattic/Iris/issues/69 - addAttribute( 'div.iris-slider.iris-strip', 'aria-label', __( 'Gradient selector', 'pressbooks' ) ); - addAttribute( '.ui-slider-handle', 'aria-label', __( 'Gradient selector', 'pressbooks' ) ); - - // Add aria-label attributes to color picker palette boxes - // https://github.com/Automattic/Iris/issues/69 - ( function (){ - let colors = document.querySelectorAll( 'a.iris-palette' ); - - for ( let i=0; i < colors.length; i++ ) { - let irisPalette = colors[ i ]; - let rgb = colors[ i ].style.backgroundColor; - let color = ''; - - if ( rgb === 'rgb(0, 0, 0)' ){ - color = __( 'Black', 'pressbooks' ) - } - if ( rgb === 'rgb(255, 255, 255)' ){ - color = __( 'White', 'pressbooks' ) - } - if ( rgb === 'rgb(221, 51, 51)' ){ - color = __( 'Red', 'pressbooks' ) - } - if ( rgb === 'rgb(221, 153, 51)' ){ - color = __( 'Orange', 'pressbooks' ) - } - if ( rgb === 'rgb(238, 238, 34)' ){ - color = __( 'Yellow', 'pressbooks' ) - } - if ( rgb === 'rgb(129, 215, 66)' ){ - color = __( 'Green', 'pressbooks' ) - } - if ( rgb === 'rgb(30, 115, 190)' ){ - color = __( 'Blue', 'pressbooks' ) - } - if ( rgb === 'rgb(130, 36, 227)' ){ - color = __( 'Purple', 'pressbooks' ) - } - - irisPalette.setAttribute( 'aria-label', __( 'Select ' + color, 'pressbooks' ) ); - } - } )(); -} ); diff --git a/inc/customizer/namespace.php b/inc/customizer/namespace.php index c689e14..ed79a7b 100644 --- a/inc/customizer/namespace.php +++ b/inc/customizer/namespace.php @@ -296,6 +296,5 @@ function enqueue_customizer_scripts() { $assets = new Assets( 'pressbooks-aldine', 'theme' ); $assets->setSrcDirectory( 'assets' )->setDistDirectory( 'dist' ); - wp_enqueue_script( 'aldine/customizer-a11y', $assets->getPath( 'scripts/customizer-a11y.js' ), [ 'wp.i18n' ], false, null ); wp_enqueue_script( 'aldine/customizer-toggle', $assets->getPath( 'scripts/customizer-toggle.js' ), false, null ); } diff --git a/package-lock.json b/package-lock.json index e993b45..a141d60 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6824,13 +6824,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6843,18 +6841,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -6957,8 +6952,7 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -6968,7 +6962,6 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6981,20 +6974,17 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.3.5", "bundled": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -7011,7 +7001,6 @@ "mkdirp": { "version": "0.5.1", "bundled": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -7084,8 +7073,7 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -7095,7 +7083,6 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { "wrappy": "1" } @@ -7201,7 +7188,6 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/webpack.mix.js b/webpack.mix.js index 9ca5937..018a669 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -45,7 +45,6 @@ mix .js( `${assets}/scripts/call-to-action.js`, `${dist}/scripts` ) .js( `${assets}/scripts/catalog-admin.js`, `${dist}/scripts` ) .js( `${assets}/scripts/customizer.js`, `${dist}/scripts` ) - .js( `${assets}/scripts/customizer-a11y.js`, `${dist}/scripts` ) .js( `${assets}/scripts/customizer-toggle.js`, `${dist}/scripts` ) .js( `${assets}/scripts/page-section.js`, `${dist}/scripts` );