Browse Source

Remove a11y stuff

pull/186/head
dannylonglegs 7 years ago
parent
commit
8caf0c27c7
  1. 55
      assets/scripts/customizer-a11y.js
  2. 1
      inc/customizer/namespace.php
  3. 28
      package-lock.json
  4. 1
      webpack.mix.js

55
assets/scripts/customizer-a11y.js

@ -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' ) );
}
} )();
} );

1
inc/customizer/namespace.php

@ -296,6 +296,5 @@ function enqueue_customizer_scripts() {
$assets = new Assets( 'pressbooks-aldine', 'theme' ); $assets = new Assets( 'pressbooks-aldine', 'theme' );
$assets->setSrcDirectory( 'assets' )->setDistDirectory( 'dist' ); $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 ); wp_enqueue_script( 'aldine/customizer-toggle', $assets->getPath( 'scripts/customizer-toggle.js' ), false, null );
} }

28
package-lock.json generated

@ -6824,13 +6824,11 @@
}, },
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -6843,18 +6841,15 @@
}, },
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -6957,8 +6952,7 @@
}, },
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -6968,7 +6962,6 @@
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -6981,20 +6974,17 @@
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
}, },
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.3.5", "version": "2.3.5",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -7011,7 +7001,6 @@
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -7084,8 +7073,7 @@
}, },
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -7095,7 +7083,6 @@
"once": { "once": {
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -7201,7 +7188,6 @@
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",

1
webpack.mix.js

@ -45,7 +45,6 @@ mix
.js( `${assets}/scripts/call-to-action.js`, `${dist}/scripts` ) .js( `${assets}/scripts/call-to-action.js`, `${dist}/scripts` )
.js( `${assets}/scripts/catalog-admin.js`, `${dist}/scripts` ) .js( `${assets}/scripts/catalog-admin.js`, `${dist}/scripts` )
.js( `${assets}/scripts/customizer.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/customizer-toggle.js`, `${dist}/scripts` )
.js( `${assets}/scripts/page-section.js`, `${dist}/scripts` ); .js( `${assets}/scripts/page-section.js`, `${dist}/scripts` );

Loading…
Cancel
Save