• Hi ??

    I am attempting to filter out a few rules, where Accessibility Checker triggers a violation due to how my theme is coded, of course after double-checking that the WCAG requirements are actually met, and keeping an eye on those areas using other tools.

    Looking at the documentation at https://equalizedigital.com/accessibility-checker/how-to-remove-rules/ the filter looks like this:

    add_filter('ac_filter_rules','my_rule_filter');
    function my_rule_filter($rules){
    $rules = ac_remove_element_with_value($rules, 'slug', 'slider_present');
    return $rules;
    }

    a) Is there a place, where I can look up the parameters for the different rules? In the example, I guess the filter targets the “Slider Present” rule. I’m specifically looking into filtering out the “Insufficient Color Contrast”, the “Empty or Missing Form Label” and possible the “Broken Skip or Anchor Link” rules.

    b) Also, I guess the ‘slug’ parameter, targets a specific URL. Is there a way, to target all posts and/or pages or a post type?

    Hope you can help.

    Kind regards
    Bjarne

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Steve Jones

    (@stevejonesdev)

    Hi @oldrup,

    I’ve update the documentation to include the rule parameters such as the slugs you’ll need to filter out specific rules. I also update the documentation to have the updated function prefixes so you’ll want to use the updated example code rather then what you have pasted above. The slug in the case don’t pertain to a specific URL and will filter rules globally. Below is an example on how to filter out the rules you listed.

    add_filter('edac_filter_rules','my_rule_filter');
    function my_rule_filter($rules){
    	$rules = edac_remove_element_with_value($rules, 'slug', 'color_contrast_failure');
    	$rules = edac_remove_element_with_value($rules, 'slug', 'empty_form_label');
    	$rules = edac_remove_element_with_value($rules, 'slug', 'broken_skip_anchor_link');
    	return $rules;
    }

    Thanks,

    Steve

    Thread Starter Bjarne Oldrup

    (@oldrup)

    Hey Steve

    Thanks for the additions to the documentation, much appreciated.

    I still struggle to get the filters to work though. I’m using the Code Snippets plugin, as always, for my few custom filters. Screenshot: https://snipboard.io/jNGktg.jpg

    Tried disabling anything I could imagine conflicting, and re-installed the plugin several times. No success: https://snipboard.io/UXhWw5.jpg

    The “how to remove all warning rules” sample, seems to kick in, but removes all issues, not only warnings.

    I will eventually test this on a fresh WP install. Let me know if you’d like a temporary login to poke around.

    Kind regards
    Bjarne

    Plugin Author Steve Jones

    (@stevejonesdev)

    Do you see any of the excluded rules in the details tab?

    Thread Starter Bjarne Oldrup

    (@oldrup)

    Yes I do. Here tested in Chrome, normally using Firefox.

    https://snipboard.io/C9c1ns.jpg

    Plugin Author Steve Jones

    (@stevejonesdev)

    Sorry it looks like I had the wrong filter set. Try this.

    add_filter('edac_filter_register_rules','my_rule_filter');
    function my_rule_filter($rules){
    	$rules = edac_remove_element_with_value($rules, 'slug', 'color_contrast_failure');
    	$rules = edac_remove_element_with_value($rules, 'slug', 'empty_form_label');
    	$rules = edac_remove_element_with_value($rules, 'slug', 'broken_skip_anchor_link');
    	return $rules;
    }

    After adding this filter the post will need to be saved again to update the error count of the summary tab.

    Thread Starter Bjarne Oldrup

    (@oldrup)

    Uh. Now we are getting somewhere…

    Have a look at this screenshot: https://snipboard.io/VFEf5e.jpg

    The “Text to small” warning is triggered on purpose – I wanted to make sure I still warnings if any exists.

    The “contrast errors” and “empty anchor link” filters kicks in just fine. No longer triggers errors.

    But the “Missing Form Label” error is still thrown. The parameter in the filter says empty_form_label (empty, not missing). A typo maybe? Two different checks?

    Thank you so much for your help ??
    Bjarne

    Plugin Author Steve Jones

    (@stevejonesdev)

    They are two different checks. This is the slug for Missing Form Label: missing_form_label

    Thread Starter Bjarne Oldrup

    (@oldrup)

    But of course ?? It’s getting late in Denmark.

    Thank you so much. Now I might “only” perform 37 checks instead of 40, but on the other side, I’m only getting warned about actual errors and there will pay attention ??

    Actually having an empty table header and missing a subheader on https://snipboard.io/zA0nGT.jpg

    Nice job. Thanks again.

    Plugin Author Steve Jones

    (@stevejonesdev)

    No problem @oldrup. Happy to help out and great job focusing on make your site more Accessible. ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to Remove Rules (filter parameter documentation)?’ is closed to new replies.