Skip to content

Commit

Permalink
Merge pull request #637 from equalizedigital/william/636/convert-text…
Browse files Browse the repository at this point in the history
…_blinking_scrolling-to-js-check

Enable the blinks and marquee axe-core rules to power the text_blinking_scrolling rule
  • Loading branch information
pattonwebz authored May 24, 2024
2 parents 1abf7d8 + 36470eb commit 02a49e2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 100 deletions.
2 changes: 2 additions & 0 deletions includes/classes/class-rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public function set_post_scan_results( $request ) {
if ( array_key_exists( 'ruleset', $rule ) && 'js' === $rule['ruleset'] ) {
$js_rule_ids[] = $rule['slug'];

// Some rules can be a grouping of other checks with different ids. This tracks those combined check IDs for later mapping.
if ( array_key_exists( 'combines', $rule ) && ! empty( $rule['combines'] ) ) {
foreach ( $rule['combines'] as $combine_rule_id ) {
$combined_rule_ids[ $combine_rule_id ] = $rule['slug'];
Expand Down Expand Up @@ -231,6 +232,7 @@ public function set_post_scan_results( $request ) {
foreach ( $violations as $violation ) {
$rule_id = $violation['ruleId'];

// If this rule is a combined rule then map it to the actual reporting rule ID.
$actual_rule_id = array_key_exists( $rule_id, $combined_rule_ids ) ? $combined_rule_ids[ $rule_id ] : $rule_id;

if ( in_array( $actual_rule_id, $js_rule_ids, true ) ) {
Expand Down
2 changes: 2 additions & 0 deletions includes/rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@
'<code>&lt;marquee&gt;</code>',
'<code>text-decoration: blink</code>'
),
'ruleset' => 'js',
'combines' => [ 'blink', 'marquee' ],
],
[
'title' => esc_html__( 'Insufficient Color Contrast', 'accessibility-checker' ),
Expand Down
100 changes: 0 additions & 100 deletions includes/rules/text_blinking_scrolling.php

This file was deleted.

2 changes: 2 additions & 0 deletions src/pageScanner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const scan = async (
values: [
'color_contrast_failure',
'underlined_text',
'blink',
'marquee',
'meta-viewport',
textJustified.id,
],
Expand Down

0 comments on commit 02a49e2

Please sign in to comment.