From 7178df715fb4ad0b735c2c02a2b1bdad7513568e Mon Sep 17 00:00:00 2001 From: dannylonglegs Date: Thu, 6 Jun 2019 14:32:50 -0400 Subject: [PATCH] Enqueue a11y script on customizer --- inc/customizer/namespace.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inc/customizer/namespace.php b/inc/customizer/namespace.php index ed79a7b..d048e60 100644 --- a/inc/customizer/namespace.php +++ b/inc/customizer/namespace.php @@ -15,7 +15,6 @@ use PressbooksMix\Assets; * @param \WP_Customize_Manager $wp_customize Theme Customizer object. */ function customize_register( \WP_Customize_Manager $wp_customize ) { - // Remove unsupported WP controls, @see \WP_Customize_Manager::register_controls $wp_customize->remove_control( 'display_header_text' ); @@ -295,6 +294,8 @@ function enqueue_color_contrast_validator() { function enqueue_customizer_scripts() { $assets = new Assets( 'pressbooks-aldine', 'theme' ); $assets->setSrcDirectory( 'assets' )->setDistDirectory( 'dist' ); + $pb_a11y_script = plugin_dir_url( 'pressbooks' ) . 'pressbooks/assets/src/scripts/a11y.js'; - wp_enqueue_script( 'aldine/customizer-toggle', $assets->getPath( 'scripts/customizer-toggle.js' ), false, null ); + wp_enqueue_script( 'pb-a11y', $pb_a11y_script, [ 'wp-i18n' ], false, true ); + wp_enqueue_script( 'aldine/customizer-toggle', $assets->getPath( 'scripts/customizer-toggle.js' ), [ 'wp-i18n', 'pb-a11y' ], null ); }