Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.13.0 #645

Merged
merged 108 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from 103 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
6a52823
Add a rule and check for empty paragraphs
pattonwebz Apr 25, 2024
c17e9c0
Run the check for empty paragraphs in JS page scanner
pattonwebz Apr 25, 2024
fc819ad
Use the id direct from the import to avoid needing to write a string …
pattonwebz Apr 25, 2024
d533bab
Add the empty paragraph rule to rules array
pattonwebz Apr 26, 2024
7b75bea
Add a filter to make empty paragraph html unique
pattonwebz Apr 26, 2024
abf8b96
Add error for zoom disabled via viewport meta tag
pattonwebz Apr 26, 2024
2aba5de
Merge branch 'develop' into william/589/add-error-if-zooming-is-disab…
pattonwebz Apr 26, 2024
ca54ed4
Make empty paragraph a warning
pattonwebz May 14, 2024
e1a5d0b
Fix filter to use method from inside the class
pattonwebz May 14, 2024
e0ac1c5
Use singular form for title and update the summary text
pattonwebz May 14, 2024
437f45d
Add a rule and check file for detection paragraphs that are possible …
pattonwebz May 14, 2024
8187628
Include the possible_heading rule in the page scanner
pattonwebz May 14, 2024
0d5ade2
Make the possible_heading rule use the js ruleset
pattonwebz May 14, 2024
e9bb544
Remove the possible_heading.php file as it is replaced by JS
pattonwebz May 14, 2024
88e3a61
Use 'empty_paragraph' as the slug for new rule
pattonwebz May 15, 2024
102cbe4
Use 'empty_paragraph_tag' as the slug for new rule
pattonwebz May 15, 2024
93856d9
Add best practices tag to new empty paragraphs rule
pattonwebz May 15, 2024
e5f5332
Merge pull request #627 from equalizedigital/release/1.12.0
pattonwebz May 15, 2024
c0e9576
Update paragraph_not_empty check to pass elements with no text conten…
pattonwebz May 20, 2024
1bcda56
Simplify the final return in paragraph_not_empty
pattonwebz May 20, 2024
2aee264
Simplify the final return in paragraph_not_empty
pattonwebz May 20, 2024
ddb578f
Improve comment in paragraph-styled-as-header.js check
pattonwebz May 20, 2024
45f435c
Add a helpers file with a fontSizeInPxxx function
pattonwebz May 21, 2024
3580bf7
Use new fontSizeInPx helper
pattonwebz May 21, 2024
b02dc50
Use < 16px in first return so that everything after it is 16px or more.
pattonwebz May 21, 2024
552f2e6
Add a helpers file with a fontSizeInPxxx function
pattonwebz May 21, 2024
06ccfce
Add a check for small text of 10px or less
pattonwebz May 22, 2024
33420b2
Add rule that checks for small text
pattonwebz May 22, 2024
2ce6562
Swap the text_small rule to the JS ruleset
pattonwebz May 22, 2024
0d6d7a0
Remove the text_small.php rule file
pattonwebz May 22, 2024
df9e07f
Add a check and rule for checking text_justified rule
pattonwebz May 22, 2024
9d27e68
Swap text_justified to the JS ruleset
pattonwebz May 22, 2024
63a08f9
Remove the text_justified.php rule file
pattonwebz May 22, 2024
bebdaff
Enable the blinks and marquee axe-core rules
pattonwebz May 22, 2024
0100608
Swap text_blinking to the JS ruleset and add a 'combines' item to the…
pattonwebz May 22, 2024
f5e901d
Add some handling for reported rules that are 'combined' from other c…
pattonwebz May 22, 2024
f452552
Remove the text_blinking_scrolling.php file as it's replaced with an …
pattonwebz May 22, 2024
7014177
Add some inline comments to detail how combined rules are handled
pattonwebz May 22, 2024
ce2a14f
Remove some code added for testing
pattonwebz May 22, 2024
479bf11
Merge branch 'develop' into william/589/add-error-if-zooming-is-disab…
pattonwebz May 22, 2024
c717a64
Add missing trailing comma
pattonwebz May 22, 2024
f422e80
Merge remote-tracking branch 'origin/william/589/add-error-if-zooming…
pattonwebz May 22, 2024
17a07e3
Add back the meta-viewport rule after merged develop in
pattonwebz May 22, 2024
c6cea02
Merge branch 'develop' into william/127/error-for-empty-paragraphs
pattonwebz May 22, 2024
5e43763
Add a since tag to new method
pattonwebz May 22, 2024
5a235cd
Merge branch 'develop' into william/612/move-possible_heading-rule-to…
pattonwebz May 22, 2024
d822449
Merge branch 'william/127/error-for-empty-paragraphs' into release/al…
pattonwebz May 22, 2024
70238a4
Merge branch 'william/612/move-possible_heading-rule-to-JS-check' int…
pattonwebz May 22, 2024
0392480
Merge branch 'william/630/convert-text_small-rule-to-JS' into release…
pattonwebz May 22, 2024
2906342
Merge branch 'william/634/convert-text_justified-rule-to-JS-check' in…
pattonwebz May 22, 2024
e4ce054
Merge branch 'william/636/convert-text_blinking_scrolling-to-js-check…
pattonwebz May 22, 2024
82f94c0
Merge branch 'develop' into release/alpha/1.13.0
pattonwebz May 22, 2024
e8a7b76
Re-add the filter on html to make elements unique when they typically…
pattonwebz May 23, 2024
1b380f2
Pass and use the version string when including the pagescanner bundle…
pattonwebz May 23, 2024
a98fbc0
Make meta-viewport a combines and rename the reported rule to meta_vi…
pattonwebz May 23, 2024
bfcdb70
Lower threshold for flagging justified text to 200 characters
pattonwebz May 23, 2024
497d90d
Use a wider group of selectors for text_justified check
pattonwebz May 23, 2024
ac23f81
Merge branch 'william/634/convert-text_justified-rule-to-JS-check' in…
pattonwebz May 23, 2024
680c868
Add some tags to the text_small rule
pattonwebz May 23, 2024
1fc87d2
Narrow the tags text_small checks against slightly
pattonwebz May 23, 2024
daaa1bc
Merge branch 'william/630/convert-text_small-rule-to-JS' into release…
pattonwebz May 23, 2024
d895dfd
Don't pass on child nodes if the first node is a text node.
pattonwebz May 23, 2024
38ddafb
Add a temporary link that points to docs for empty paragraphs
pattonwebz May 23, 2024
a200fa2
Merge remote-tracking branch 'origin/william/127/error-for-empty-para…
pattonwebz May 23, 2024
c50cdb9
Merge branch 'william/127/error-for-empty-paragraphs' into release/al…
pattonwebz May 23, 2024
9c1ac6f
Don't check possible headings if they are in blockquote, figcaption o…
pattonwebz May 23, 2024
094397d
Make meta-viewport a combines and rename the reported rule to meta_vi…
pattonwebz May 23, 2024
ec78362
Add some handling for reported rules that are 'combined' from other c…
pattonwebz May 22, 2024
1c0619c
Merge pull request #592 from equalizedigital/william/589/add-error-if…
pattonwebz May 24, 2024
dca64de
Update text_justified summary text
pattonwebz May 24, 2024
8af9ef6
Merge branch 'develop' into william/634/convert-text_justified-rule-t…
pattonwebz May 24, 2024
1abf7d8
Merge pull request #635 from equalizedigital/william/634/convert-text…
pattonwebz May 24, 2024
36470eb
Merge branch 'develop' into william/636/convert-text_blinking_scrolli…
pattonwebz May 24, 2024
02a49e2
Merge pull request #637 from equalizedigital/william/636/convert-text…
pattonwebz May 24, 2024
fc2f325
Update info/docs link for empty paragraph rule
pattonwebz May 24, 2024
404bc15
Add text for possible_heading rule
pattonwebz May 24, 2024
01b14e6
added - viewable option to rules array and updated conditional on the…
SteveJonesDev May 24, 2024
cddf1ae
Update some code comments
pattonwebz May 24, 2024
26c5f54
Simplify the node value check early bail
pattonwebz May 24, 2024
c6bb1ac
Merge branch 'develop' into william/630/convert-text_small-rule-to-JS
pattonwebz May 24, 2024
2f06db0
Merge pull request #633 from equalizedigital/william/630/convert-text…
pattonwebz May 24, 2024
4e3bc10
Merge branch 'develop' into william/127/error-for-empty-paragraphs
pattonwebz May 24, 2024
6fe9e5e
Merge pull request #591 from equalizedigital/william/127/error-for-em…
pattonwebz May 24, 2024
6274a5b
Use a simplified catch for null and undefined as early bail
pattonwebz May 24, 2024
913aeca
Handle potential `NaN` values by checking for instance of Number
pattonwebz May 24, 2024
01bfc89
Merge remote-tracking branch 'origin/william/612/move-possible_headin…
pattonwebz May 24, 2024
97ea323
Merge branch 'develop' into william/612/move-possible_heading-rule-to…
pattonwebz May 24, 2024
c7b2130
Merge pull request #622 from equalizedigital/william/612/move-possibl…
pattonwebz May 24, 2024
18ecf1a
Merge branch 'develop' into release/alpha/1.13.0
pattonwebz May 24, 2024
7f9c3b8
Fix extra space before opening bracket
pattonwebz May 24, 2024
a04536f
Merge pull request #640 from equalizedigital/steve/no-issue/add-rule-…
SteveJonesDev May 24, 2024
50e32d5
Merge pull request #638 from equalizedigital/release/alpha/1.13.0
pattonwebz May 24, 2024
6322ea8
Don't flag missing iframe title if it's display: none and visibility:…
pattonwebz May 24, 2024
7f96573
Check for `typeof` 'number' instead of `instanceof Number`
pattonwebz May 24, 2024
19f646c
Merge pull request #642 from equalizedigital/william/no-issue/fix-fon…
pattonwebz May 24, 2024
5e4335c
Merge branch 'develop' into william/184/exclude-iframes-from-empty-ti…
pattonwebz May 24, 2024
47bb153
Update the zooming and scaling user facing title and the help link
pattonwebz May 28, 2024
b212b32
Merge pull request #643 from equalizedigital/william/69/zooming-and-s…
pattonwebz May 28, 2024
99ebe93
Remove the dry run flag in the deploy-on-release-to-dot-org.yml workflow
pattonwebz May 28, 2024
995d953
Merge pull request #644 from equalizedigital/william/no-issue/remove-…
pattonwebz May 28, 2024
2ad07b0
Merge pull request #641 from equalizedigital/william/184/exclude-ifra…
pattonwebz May 28, 2024
5c09e00
Bump version 1.12.0 -> 1.13.0
pattonwebz May 28, 2024
4c0f166
Add changelog for 1.13.0
pattonwebz May 28, 2024
39e9fc0
Correct missing summaries in some rules
pattonwebz May 28, 2024
7f1392d
Fix some typos in summaries
pattonwebz May 28, 2024
880d16e
Merge pull request #647 from equalizedigital/william/646/sync-summari…
pattonwebz May 28, 2024
4215ac5
Correct iframe_missing_title summary
pattonwebz May 29, 2024
ca4e60c
Merge pull request #648 from equalizedigital/william/628/correct_ifra…
pattonwebz May 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/deploy-on-release-to-dot-org.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ jobs:
- name: WordPress plugin deploy
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
with:
dry-run: true # exists to prevent accidental deploys during testing
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions accessibility-checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Plugin Name: Accessibility Checker
* Plugin URI: https://a11ychecker.com
* Description: Audit and check your website for accessibility before you hit publish. In-post accessibility scanner and guidance.
* Version: 1.12.0
* Version: 1.13.0
* Author: Equalize Digital
* Author URI: https://equalizedigital.com
* License: GPL-2.0+
Expand All @@ -35,7 +35,7 @@

// Current plugin version.
if ( ! defined( 'EDAC_VERSION' ) ) {
define( 'EDAC_VERSION', '1.12.0' );
define( 'EDAC_VERSION', '1.13.0' );
}

// Current database version.
Expand Down
2 changes: 1 addition & 1 deletion admin/class-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ function ( $a, $b ) {

$html .= '<button class="edac-details-rule-records-record-actions-ignore' . $ignore_class . '" aria-expanded="false" aria-controls="edac-details-rule-records-record-ignore-' . $row['id'] . '">' . EDAC_SVG_IGNORE_ICON . '<span class="edac-details-rule-records-record-actions-ignore-label">' . $ignore_label . '</span></button>';

if ( 'missing_headings' !== $rule['slug'] ) {
if ( ! isset( $rule['viewable'] ) || $rule['viewable'] ) {

$url = add_query_arg(
[
Expand Down
1 change: 1 addition & 0 deletions admin/class-enqueue-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public static function maybe_enqueue_admin_and_editor_app_scripts() {
$post_id,
[ 'edac_pageScanner' => 1 ]
),
'version' => EDAC_VERSION,
]
);

Expand Down
55 changes: 46 additions & 9 deletions includes/classes/class-rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function __construct() {
*/
public function init_hooks() {
add_action( 'init', [ $this, 'init_rest_routes' ] );
add_filter( 'edac_filter_js_violation_html', [ $this, 'filter_js_validation_html' ], 10, 3 );
}


Expand Down Expand Up @@ -161,7 +162,28 @@ function () use ( $ns, $version ) {
);
}


/**
* Filter the html of the js validation violation.
*
* This can be used to store additional data in the html of the violation.
*
* @since 1.13.0
* @param string $html The html of the violation.
* @param string $rule_id The id of the rule.
* @param array $violation The violation data.
*
* @return string
*/
public function filter_js_validation_html( string $html, string $rule_id, array $violation ): string {
// Add the selector to the violation message as empty paragraphs are almost always
// duplicate html fragments. Adding the selector makes it unique, so it can be saved.
if ( 'empty_paragraph_tag' === $rule_id ) {
$html .= $violation['selector'][0]
? '// {{ ' . $violation['selector'][0] . ' }}'
: '';
}
return $html;
}

/**
* REST handler that saves to the DB a list of js rule violations for a post.
Expand Down Expand Up @@ -194,11 +216,19 @@ public function set_post_scan_results( $request ) {

//phpcs:ignore Generic.Commenting.Todo.TaskFound
// TODO: setup a rules class for loading/filtering rules.
$rules = edac_register_rules();
$js_rule_ids = [];
$rules = edac_register_rules();
$js_rule_ids = [];
$combined_rule_ids = [];
foreach ( $rules as $rule ) {
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 @@ -226,17 +256,20 @@ public function set_post_scan_results( $request ) {
foreach ( $violations as $violation ) {
$rule_id = $violation['ruleId'];

if ( in_array( $rule_id, $js_rule_ids, true ) ) {
// 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 ) ) {

// This rule is one that we've included in our js ruleset.

$html = $violation['html'];
$html = apply_filters( 'edac_filter_js_violation_html', $violation['html'], $rule_id, $violation );
$impact = $violation['impact']; // by default, use the impact setting from the js rule.

//phpcs:ignore Generic.Commenting.Todo.TaskFound
// TODO: setup a rules class for loading/filtering rules.
foreach ( $rules as $rule ) {
if ( $rule['slug'] === $rule_id ) {
if ( $rule['slug'] === $actual_rule_id ) {
$impact = $rule['rule_type']; // if we are defining the rule_type in php rules config, use that instead of the js rule's impact setting.
}
}
Expand All @@ -255,9 +288,9 @@ public function set_post_scan_results( $request ) {
* @param string $rule_id The rule ID.
* @param string $type The type of validation which is always 'js' in this path.
*/
do_action( 'edac_before_rule', $post_id, $rule_id, 'js' );
do_action( 'edac_before_rule', $post_id, $actual_rule_id, 'js' );

( new Insert_Rule_Data() )->insert( $post, $rule_id, $impact, $html );
( new Insert_Rule_Data() )->insert( $post, $actual_rule_id, $impact, $html );

/**
* Fires after a rule is run against the content.
Expand All @@ -270,7 +303,7 @@ public function set_post_scan_results( $request ) {
* @param string $rule_id The rule ID.
* @param string $type The type of validation which is always 'js' in this path.
*/
do_action( 'edac_after_rule', $post_id, $rule_id, 'js' );
do_action( 'edac_after_rule', $post_id, $actual_rule_id, 'js' );

}
}
Expand All @@ -297,6 +330,10 @@ public function set_post_scan_results( $request ) {
// store a record of this scan in the post's meta.
update_post_meta( $post_id, '_edac_post_checked_js', time() );

if ( true === $request['isFailure'] ) {
update_post_meta( $post_id, '_edac_post_checked_js_failure', time() );
}

return new \WP_REST_Response(
[
'success' => true,
Expand Down
32 changes: 25 additions & 7 deletions includes/rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@
'<code>&lt;h2&gt;</code>'
),
],
[
'title' => esc_html__( 'Empty Paragraph Tag', 'accessibility-checker' ),
'info_url' => 'https://a11ychecker.com/help7870',
'slug' => 'empty_paragraph_tag',
'rule_type' => 'warning',
'summary' => esc_html__( 'An Empty Paragraph Tag warning means there is a paragraph tag present that does not contain content. These may be announced by screen readers or create confusion for users. To fix this warning, remove the empty paragraphs from the page. If you need to add spacing between sections, this should be done with padding, margins, or a spacer block.', 'accessibility-checker' ),
'ruleset' => 'js',
],
[
'title' => esc_html__( 'iFrame Missing Title', 'accessibility-checker' ),
'info_url' => 'https://a11ychecker.com/help1953',
Expand All @@ -98,19 +106,15 @@
'<code>&lt;h1&gt;</code>',
'<code>&lt;h6&gt;</code>'
),
'viewable' => false,
],
[
'title' => esc_html__( 'Text Justified', 'accessibility-checker' ),
'info_url' => 'https://a11ychecker.com/help1980',
'slug' => 'text_justified',
'rule_type' => 'warning',
'summary' => sprintf(
// translators: %s is <code>&lt;p&gt;</code>, %s is <code>&lt;div&gt;</code>, %s is <code>&lt;td&gt;</code>.
esc_html__( 'A Text Justified warning shows up in Accessibility Checker when the text on your post or page, either a %1$s, %2$s, or %3$s element, with more than 500 characters has been styled with a justified alignment (text-align:justify). To fix this warning, you will need to remove the justified styling from the specified text elements.', 'accessibility-checker' ),
'<code>&lt;p&gt;</code>',
'<code>&lt;div&gt;</code>',
'<code>&lt;td&gt;</code>'
),
'summary' => esc_html__( 'A Text Justified warning appears in Accessibility Checker when text with more than 200 characters on your post or page is styled with justified alignment (text-align:justify). To fix this warning, remove the justified styling from the specified text elements.', 'accessibility-checker' ),
'ruleset' => 'js',
],
[
'title' => esc_html__( 'Link Opens New Window or Tab', 'accessibility-checker' ),
Expand Down Expand Up @@ -315,13 +319,15 @@
'slug' => 'text_small',
'rule_type' => 'warning',
'summary' => esc_html__( 'A Text Too Small warning occurs when there is text on your website that is less than 10px in size. The warning is an indication that you may want to rethink the font size and make it larger so that it can be more easily read without a user needing zoom in on their browser. To fix text that is too small, you will need to ensure that all text elements on your website are at least 10 points.', 'accessibility-checker' ),
'ruleset' => 'js',
],
[
'title' => esc_html__( 'Possible Heading', 'accessibility-checker' ),
'info_url' => 'https://a11ychecker.com/help1969',
'slug' => 'possible_heading',
'rule_type' => 'warning',
'summary' => esc_html__( 'A Possible Heading warning occurs when there is text on a page that appears to be a heading, but has not been coded with proper heading tags. This warning is appears if there are short phrases or strings of text less than 50 characters in length that are formatted in a way which suggests they might be being used as headers (they are 20 pixels or bigger, or are 16 pixels or bigger and bold and/or italicized). To fix a Possible Heading warning, you will need to determine if the flagged text is indeed intended to be a heading. If so, you need to change it from a paragraph to a heading at the proper level. If it is not supposed to be a heading then you can safely “Ignore” the warning.', 'accessibility-checker' ),
'ruleset' => 'js',
],
[
'title' => esc_html__( 'Blinking or Scrolling Content', 'accessibility-checker' ),
Expand All @@ -335,6 +341,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 Expand Up @@ -420,4 +428,14 @@
'<code>&lt;a&gt;</code>'
),
],
[
'title' => esc_html__( 'Zooming and Scaling Disabled', 'accessibility-checker' ),
'info_url' => 'https://a11ychecker.com/help7947',
'slug' => 'meta_viewport',
'rule_type' => 'error',
'summary' => esc_html__( 'Zooming is disabled via viewport meta tag that includes `user-scalable=no` or a `maximum-scale` value of less than 2. This limits low-vision users that want to increase text sizes, zoom into the page or who use a magnifier.', 'accessibility-checker' ),
'ruleset' => 'js',
'combines' => [ 'meta-viewport' ],
'viewable' => false,
],
];
7 changes: 6 additions & 1 deletion includes/rules/iframe_missing_title.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase -- underscore is for valid function name.
/**
* Accessibility Checker pluign file.
* Accessibility Checker plugin file.
*
* @package Accessibility_Checker
*/
Expand All @@ -21,6 +21,11 @@ function edac_rule_iframe_missing_title( $content, $post ) { // phpcs:ignore --
foreach ( $iframe_tags as $iframe ) {
if ( isset( $iframe ) && empty( $iframe->getAttribute( 'title' ) ) && empty( $iframe->getAttribute( 'aria-label' ) ) ) {

$display_none_and_visibility_hidden = preg_match( '/(?=.*display\s*:\s*none)(?=.*visibility\s*:\s*hidden)/is', $iframe->getAttribute( 'style' ) );
if ( $display_none_and_visibility_hidden ) {
continue;
}

$iframecode = htmlspecialchars( $iframe->outertext );

$errors[] = $iframecode;
Expand Down
Loading
Loading