Title: Fixing NU HTML validator errors
Last modified: December 5, 2023

---

# Fixing NU HTML validator errors

 *  Resolved [patternmb](https://wordpress.org/support/users/patternmb/)
 * (@patternmb)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/fixing-nu-html-validator-errors/)
 * Hi! First, thanks for this handy plugin!
 * I’d like to suggest a change for an issue I am having. This plugin is adding 
   a <style> tag in the body that which results in the error _“Element style not
   allowed as child of element body in this context.”_ as noted by Nu HTML validator(
   [https://validator.nu/](https://validator.nu/)). This is a requirement for some
   accessiblity testing I am doing – that there is no HTML parsing errors.
 * Currently using version 2.6.5. In this version the style code is output by mystickymenu\
   welcome-bar.php at line 1405 – 1981. The solution that worked for me is moving
   the style out of the _mysticky\_welcome\_bar\_frontend_ function which uses _add\
   _action( ‘wp\_footer’, ‘mysticky\_welcome\_bar\_frontend_‘_ );_ and into a new
   function which uses _add\_action(‘wp\_head’, ‘mysticky\_welcome\_bar\_frontend\
   _styles’); _ to put the <style> into the head instead of the body.
 * So my code is added below _mysticky\_welcome\_bar\_frontend _and looks like this:
 *     ```wp-block-code
       function mysticky_welcome_bar_frontend_styles()
       {
   
       	$welcomebar = get_option( 'mysticky_option_welcomebar' );
   
       	if ( ( isset($welcomebar['mysticky_welcomebar_expirydate']) && $welcomebar['mysticky_welcomebar_expirydate'] !='' && strtotime( date('m/d/Y')) > strtotime($welcomebar['mysticky_welcomebar_expirydate']) ) || !isset($welcomebar['mysticky_welcomebar_enable'] ) || (isset($welcomebar['mysticky_welcomebar_enable']) && $welcomebar['mysticky_welcomebar_enable'] == 0) ) {
       		return;
       	}
   
       	if( isset($welcomebar['mysticky_welcomebar_font']) && $welcomebar['mysticky_welcomebar_font'] == 'System Stack' ){
       		$welcomebar['mysticky_welcomebar_font'] = '-apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';
       	}
   
       	$welcomebar['mysticky_welcomebar_font'] = (isset($welcomebar['mysticky_welcomebar_font']) && $welcomebar['mysticky_welcomebar_font'] == 'Inherit') ? strtolower($welcomebar['mysticky_welcomebar_font']) : $welcomebar['mysticky_welcomebar_font'];
   
        ?>
        	<style>
       /* The CSS code ... */
               </style>
       <?php
       }
       add_action('wp_head', 'mysticky_welcome_bar_frontend_styles');
       ```
   
 * A couple other changes I made is adding attributes to the close button to make
   it keyboard and screen reader accessible (tabindex, role. and aria-label).
 *     ```wp-block-code
       <span class="mysticky-welcomebar-close" style="color:#ffffff" tabindex="0" role="button" aria-label="close">X</span>
       ```
   
 *     ```wp-block-code
       // JS snippet to allow close button to work with keyboard.
       $('.mysticky-welcomebar-close').on('keydown', function(e) {
               if(e.keyCode == '13'){
       		$(this).trigger('click');
       	}
       });
       ```
   
 * Unfortunately I will have to re-add these changes after any updates. So, I was
   wondering if it is possible for your team to incorporate something similar into
   the plugin?
 * Cheers!
    -  This topic was modified 2 years, 5 months ago by [patternmb](https://wordpress.org/support/users/patternmb/).
    -  This topic was modified 2 years, 5 months ago by [patternmb](https://wordpress.org/support/users/patternmb/).

Viewing 1 replies (of 1 total)

 *  Plugin Support [Karina](https://wordpress.org/support/users/karinapremio/)
 * (@karinapremio)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/fixing-nu-html-validator-errors/#post-17268987)
 * Hey there, thanks for reaching out and for sharing this valuable feedback. I’ll
   pass onto our team for consideration!

Viewing 1 replies (of 1 total)

The topic ‘Fixing NU HTML validator errors’ is closed to new replies.

 * ![](https://ps.w.org/mystickymenu/assets/icon-256x256.gif?rev=2935479)
 * [My Sticky Bar - Floating Notification Bar & Sticky Header (formerly myStickymenu)](https://wordpress.org/plugins/mystickymenu/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mystickymenu/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mystickymenu/)
 * [Active Topics](https://wordpress.org/support/plugin/mystickymenu/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mystickymenu/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mystickymenu/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Karina](https://wordpress.org/support/users/karinapremio/)
 * Last activity: [2 years, 5 months ago](https://wordpress.org/support/topic/fixing-nu-html-validator-errors/#post-17268987)
 * Status: resolved