[Resolved] Redundant WAI-ARIA attribute on main and footer

Home Forums Support [Resolved] Redundant WAI-ARIA attribute on main and footer

Home Forums Support Redundant WAI-ARIA attribute on main and footer

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #289288
    morriscountynj

    Just wanted to give you the heads up — I use a QA and Accessibility auditing tool called Siteimprove, and have spoken to their accessibility expert on staff.

    They recommend that wherever HTML5 tags are used, the redundant WAI-ARIA attribute is NOT required.

    On their audit, Generatepress gets two dings for this:

    <main id="main" role="main">
    and
    <footer role="contentinfo">

    According to Siteimprove, the error is as follows:

    A WAI-ARIA attribute that has the exact same features as the HTML element it has been applied to has been used. The WAI-ARIA attribute is redundant since is doesn’t provide the user with any additional information.

    For landmarks it has previously been a recommendation to use HTML5 and WAI-ARIA landmark roles together (e.g. WAI-ARIA role=”navigation” on HTML5 ‘nav’ elements) to maximize support, but with the widespread adoption of HTML5 this is no longer needed.

    The WAI-ARIA attribute can be removed without any impact for end users. The result will be cleaner, easier to maintain code.

    So I think you can safely remove role=”main” and role=”contentinfo” from the theme. πŸ™‚

    GeneratePress 1.3.44
    GP Premium 1.2.94
    #289315
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Those actually should have been removed a lot time ago – what version of GP are you using on the affected site?

    #289358
    morriscountynj

    Oh good to know. Looks like these are my bad, I have custom footer.php and page.php files in my child theme! I’ll go ahead and change these manually. πŸ™‚

    #289359
    morriscountynj

    Speaking of my manual footer.php —

    This is probably an annoying question, but, below is my code in my footer.php. I’m looking at the code in the parent theme and I see do_action( ‘generate_footer’), etc. Does that replace what my code currently does? Can I just remove my child theme footer.php at this point?

    Code:

    <?php
    /**
     * The template for displaying the footer.
     *
     * Contains the closing of the id=main div and all content after
     *
     * @package Generate
     */
    ?>
    
    	</div><!-- #content -->
    </div><!-- #page -->
    <?php do_action('generate_before_footer'); ?>
    <div <?php generate_footer_class(); ?>>
    	<?php 
    	do_action('generate_before_footer_content');
    	global $post;
    	$generate_settings = wp_parse_args( 
    		get_option( 'generate_settings', array() ), 
    		generate_get_defaults() 
    	);
    	$stored_meta = '';
    	if ( isset( $post ) ) :
    		$stored_meta = get_post_meta( $post->ID, '_generate-footer-widget-meta', true );
    	endif;
    	
    	// Don't run the function unless we're on a page it applies to
    	if ( ! is_singular() ) :
    		$stored_meta = '';
    	endif;
    	
    	if ( '' !== $stored_meta && false !== $stored_meta ) :
    		$generate_settings['footer_widget_setting'] = $stored_meta;
    	endif;
    	
    	if ( !empty( $generate_settings['footer_widget_setting'] ) && 0 !== $generate_settings['footer_widget_setting'] ) : 
    		$widget_width = '';
    		if ( $generate_settings['footer_widget_setting'] == 1 ) $widget_width = '100';
    		if ( $generate_settings['footer_widget_setting'] == 2 ) $widget_width = '50';
    		if ( $generate_settings['footer_widget_setting'] == 3 ) $widget_width = '33';
    		if ( $generate_settings['footer_widget_setting'] == 4 ) $widget_width = '25';
    		if ( $generate_settings['footer_widget_setting'] == 5 ) $widget_width = '20';
    		?>
    		<div id="footer-widgets" class="site footer-widgets">
    			<div class="inside-footer-widgets grid-container grid-parent">
    				<?php if ( $generate_settings['footer_widget_setting'] >= 1 ) : ?>
    					<div class="footer-widget-1 grid-parent grid-<?php echo $widget_width; ?>">
    						<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-1')): ?>
    							<aside class="widget inner-padding widget_text">
    								<h4 class="widget-title"><?php _e('Footer Widget 1','generate');?></h4>			
    								<div class="textwidget">
    									<p><?php _e('Replace this widget content by going to <a href="' . admin_url() . 'widgets.php"><strong>Appearance / Widgets</strong></a> and dragging widgets into Footer Area 1.','generate');?></p>
    									<p><?php _e('To remove or choose the number of footer widgets, go to <a href="' . admin_url() . 'customize.php"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generate');?></p>
    								</div>
    							</aside>
    						<?php endif; ?>
    					</div>
    				<?php endif;
    				
    				if ( $generate_settings['footer_widget_setting'] >= 2 ) : ?>
    				<div class="footer-widget-2 grid-parent grid-<?php echo $widget_width; ?>">
    					<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-2')): ?>
    						<aside class="widget inner-padding widget_text">
    							<h4 class="widget-title"><?php _e('Footer Widget 2','generate');?></h4>			
    							<div class="textwidget">
    								<p><?php _e('Replace this widget content by going to <a href="' . admin_url() . 'widgets.php"><strong>Appearance / Widgets</strong></a> and dragging widgets into Footer Area 2.','generate');?></p>
    								<p><?php _e('To remove or choose the number of footer widgets, go to <a href="' . admin_url() . 'customize.php"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generate');?></p>
    							</div>
    						</aside>
    					<?php endif; ?>
    				</div>
    				<?php endif;
    				
    				if ( $generate_settings['footer_widget_setting'] >= 3 ) : ?>
    				<div class="footer-widget-3 grid-parent grid-<?php echo $widget_width; ?>">
    					<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-3')): ?>
    						<aside class="widget inner-padding widget_text">
    							<h4 class="widget-title"><?php _e('Footer Widget 3','generate');?></h4>			
    							<div class="textwidget">
    								<p><?php _e('Replace this widget content by going to <a href="' . admin_url() . 'widgets.php"><strong>Appearance / Widgets</strong></a> and dragging widgets into Footer Area 3.','generate');?></p>
    								<p><?php _e('To remove or choose the number of footer widgets, go to <a href="' . admin_url() . 'customize.php"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generate');?></p>
    							</div>
    						</aside>
    					<?php endif; ?>
    				</div>
    				<?php endif;
    				
    				if ( $generate_settings['footer_widget_setting'] >= 4 ) : ?>
    				<div class="footer-widget-4 grid-parent grid-<?php echo $widget_width; ?>">
    					<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-4')): ?>
    						<aside class="widget inner-padding widget_text">
    							<h4 class="widget-title"><?php _e('Footer Widget 4','generate');?></h4>			
    							<div class="textwidget">
    								<p><?php _e('Replace this widget content by going to <a href="' . admin_url() . 'widgets.php"><strong>Appearance / Widgets</strong></a> and dragging widgets into Footer Area 4.','generate');?></p>
    								<p><?php _e('To remove or choose the number of footer widgets, go to <a href="' . admin_url() . 'customize.php"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generate');?></p>
    							</div>
    						</aside>
    					<?php endif; ?>
    				</div>
    				<?php endif;
    				
    				if ( $generate_settings['footer_widget_setting'] >= 5 ) : ?>
    				<div class="footer-widget-5 grid-parent grid-<?php echo $widget_width; ?>">
    					<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-5')): ?>
    						<aside class="widget inner-padding widget_text">
    							<h4 class="widget-title"><?php _e('Footer Widget 5','generate');?></h4>			
    							<div class="textwidget">
    								<p><?php _e('Replace this widget content by going to <a href="' . admin_url() . 'widgets.php"><strong>Appearance / Widgets</strong></a> and dragging widgets into Footer Area 5.','generate');?></p>
    								<p><?php _e('To remove or choose the number of footer widgets, go to <a href="' . admin_url() . 'customize.php"><strong>Appearance / Customize / Layout / Footer Widgets</strong></a>.','generate');?></p>
    							</div>
    						</aside>
    					<?php endif; ?>
    				</div>
    				<?php endif; ?>
    			</div>
    		</div>
    	<?php
    	endif;
    	do_action('generate_after_footer_widgets');
    	?>
    	<footer class="site-info" itemtype="http://schema.org/WPFooter" itemscope="itemscope" role="contentinfo">
    		<div class="inside-site-info grid-container grid-parent">
    			<?php do_action( 'generate_credits' ); ?>
    		</div>
    	</footer><!-- .site-info -->
    	<?php do_action( 'generate_after_footer_content' ); ?>
    </div><!-- .site-footer -->
    
    <?php wp_footer(); ?>
    
    </body>
    </html>
    #289421
    Tom
    Lead Developer
    Lead Developer

    It depends – why did you add the footer.php file in the first place?

    #289735
    morriscountynj

    Fair question πŸ™‚ Been awhile. But honestly I’m not seeing why I did this in the first place. I just removed my custom footer.php on one of my sites and it made no difference, so thinking I’ll do that for all of them. Thanks πŸ™‚

    #289814
    Tom
    Lead Developer
    Lead Developer
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.