diff --git a/accessibility-checker.php b/accessibility-checker.php
index 69db0e12..b04de3fa 100755
--- a/accessibility-checker.php
+++ b/accessibility-checker.php
@@ -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.16.1
+ * Version: 1.16.2
* Author: Equalize Digital
* Author URI: https://equalizedigital.com
* License: GPL-2.0+
@@ -35,7 +35,7 @@
// Current plugin version.
if ( ! defined( 'EDAC_VERSION' ) ) {
- define( 'EDAC_VERSION', '1.16.1' );
+ define( 'EDAC_VERSION', '1.16.2' );
}
// Current database version.
diff --git a/admin/class-admin-notices.php b/admin/class-admin-notices.php
index 085bd3e9..7ee604d1 100644
--- a/admin/class-admin-notices.php
+++ b/admin/class-admin-notices.php
@@ -92,23 +92,19 @@ public function edac_remove_admin_notices() {
public function edac_black_friday_notice() {
// check if accessibility checker pro is active.
- $pro = is_plugin_active( 'accessibility-checker-pro/accessibility-checker-pro.php' );
- if ( $pro ) {
+ if ( is_plugin_active( 'accessibility-checker-pro/accessibility-checker-pro.php' ) ) {
return;
}
- // Get the value of the 'edac_gaad_notice_dismiss' option and sanitize it.
- $dismissed = absint( get_option( 'edac_black_friday_2023_notice_dismiss', 0 ) );
-
// Check if the notice has been dismissed.
- if ( $dismissed ) {
+ if ( absint( get_option( 'edac_black_friday_2024_notice_dismiss', 0 ) ) ) {
return;
}
- // Show from November 20-30.
+ // Show from November 25 to December 03.
$current_date = date_i18n( 'Ymd' ); // Use date_i18n for localization.
- $start_date = '20231120';
- $end_date = '20231130';
+ $start_date = '20241125';
+ $end_date = '20241203';
if ( $current_date >= $start_date && $current_date <= $end_date ) {
@@ -131,7 +127,7 @@ public function edac_get_black_friday_message() {
// Construct the promotional message.
$message = '
';
$message .= '
' . esc_html__( '🎉 Black Friday special! 🎉', 'accessibility-checker' ) . '
';
- $message .= esc_html__( 'Upgrade to a paid version of Accessibility Checker from November 20-30 and get 40% off! Full site scanning, site-wide open issues report, ignore logs, and more.', 'accessibility-checker' ) . '
';
+ $message .= esc_html__( 'Upgrade to a paid version of Accessibility Checker from November 25th to December 3rd and get 30% off! Full site scanning, site-wide open issues report, ignore logs, and more.', 'accessibility-checker' ) . '
';
$message .= '' . esc_html__( 'Ask a Pre-Sale Question', 'accessibility-checker' ) . ' ';
$message .= '' . esc_html__( 'Upgrade Now', 'accessibility-checker' ) . '
';
$message .= '
';
@@ -157,7 +153,7 @@ public function edac_black_friday_notice_ajax() {
}
- $results = update_option( 'edac_black_friday_2023_notice_dismiss', true );
+ $results = update_option( 'edac_black_friday_2024_notice_dismiss', true );
if ( ! $results ) {
diff --git a/changelog.txt b/changelog.txt
index 3353973e..ce9e6306 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,5 +1,46 @@
Newer versions can be found in readme.txt.
+= 1.14.3 =
+* Fixed: Allow empty_link rule to detect actually empty links
+
+= 1.14.2 =
+* Enhancement: Reduce false positives for underlined text check
+* Fixed: Frontend highlighter could not be moved to the right side of the window on mobile
+* Fixed: Issue where ignores were not being saved and failing silently
+
+= 1.14.1 =
+* Fixed: Prevent settings page layout issue
+
+= 1.14.0 =
+* Added: Option to move front-end highlighter to opposite side of the window
+* Fixed: Prevent image from overspilling container in issue view
+* Fixed: Make empty paragraph check more accurate
+* Enhancement: Improved styling for settings page
+* Enhancement: Updated summary widget with better semantics
+* Enhancement: Improved aria labeling for view on page links
+* Enhancement: Added large batch processing capabilities for issue ignoring
+
+= 1.13.1 =
+* Enhancement: Make the new window warning detection less rigid
+* Fixed: Avoid flagging possible headings when the entire text is not wrapped
+* Fixed: Allow JS checked rules to retain ignored state between scans
+
+= 1.13.0 =
+* Added: Meta Viewport zoom-able and scale-able check
+* Added: Empty Paragraph warning
+* Fixed: Properly determine possible headings with computed styles
+* Improved: Better detection of the underlined text
+* Improved: Better detection of small text
+* Improved: Better detection of justified text
+* Improved: Better detection of blink and marquee tags
+* Improved: No longer flagging GTM iframes as missing title since they are display: none and visibility: hidden
+* Enhancement: Do not show 'View on page' link to frontend when the issues cannot be viewed
+
+= 1.12.0 =
+* Fixed: Use the last generation time in summary widgets rather than last completed scan time
+* Improved: More accessible panels in the editor
+* Improved: Filter and action docs added/improved
+
= 1.11.2
* Fixed: Avoid displaying `0th` for readability score
* Removed: Some custom WP Playground detection code
diff --git a/includes/rules.php b/includes/rules.php
index 2822b52d..cc376cca 100644
--- a/includes/rules.php
+++ b/includes/rules.php
@@ -9,7 +9,6 @@
TabindexFix,
AddLabelToUnlabelledFormFieldsFix,
CommentSearchLabelFix,
- ReadMoreAddTitleFix,
PreventLinksOpeningNewWindowFix,
HTMLLangAndDirFix,
AddMissingOrEmptyPageTitleFix,
@@ -243,6 +242,7 @@
'slug' => 'link_ms_office_file',
'rule_type' => 'warning',
'summary' => esc_html__( 'A Link to MS Office File warning means that one or more of the links on your page or post directs to a file with one of the following file extensions: .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pps or .ppsx. This warning appears when an MS Office file is present as a reminder to manually test your Word documents, PowerPoint presentations, and Excel spreadsheets for accessibility and to confirm that they conform to all relevant WCAG guidelines. To resolve a Link to MS Office File warning, you need to: (1) ensure a direct link to view or download the document is present if you\'re using a plugin to embed it on the page; (2) ensure the link to the document warns users it is a link to a document by displaying the specific file extension in the link anchor; and (3) test and remediate your MS Office file for accessibility errors. After determining your file is fully accessible, you can safely “Ignore” the warning.', 'accessibility-checker' ),
+ 'ruleset' => 'js',
],
[
'title' => esc_html__( 'Link to PDF', 'accessibility-checker' ),
@@ -250,6 +250,7 @@
'slug' => 'link_pdf',
'rule_type' => 'warning',
'summary' => esc_html__( 'A Link to PDF warning means that one or more of the links on your page or post directs to a PDF file. This warning is a reminder to manually test the linked PDF for accessibility and to confirm that it conforms to all relevant WCAG guidelines. To resolve a Link to PDF warning, you need to: (1) ensure a direct link to view or download the document is present if you\'re using a plugin to embed it on the page; (2) ensure the link to the document warns users it is a link to a document by displaying the specific file extension in the link anchor; and (3) test and remediate your document for accessibility errors. After determining your file is fully accessible, you can safely “Ignore” the warning.', 'accessibility-checker' ),
+ 'ruleset' => 'js',
],
[
'title' => esc_html__( 'Link to Non-HTML File', 'accessibility-checker' ),
diff --git a/includes/rules/link_ms_office_file.php b/includes/rules/link_ms_office_file.php
deleted file mode 100644
index cd3afad9..00000000
--- a/includes/rules/link_ms_office_file.php
+++ /dev/null
@@ -1,44 +0,0 @@
-find( 'a' );
- foreach ( $as as $a ) {
- // Get the href attribute of the anchor tag.
- $href = $a->getAttribute( 'href' );
- if ( $href ) {
- // Remove any query or fragment from the URL.
- $url_components = wp_parse_url( $href );
- $clean_path = $url_components['path'] ?? '';
-
- // Check if cleaned URL contains any file extension.
- foreach ( $file_extensions as $file_extension ) {
- // Check if the cleaned path ends with a file extension.
- if ( substr( strtolower( $clean_path ), -strlen( $file_extension ) ) === $file_extension ) {
- // If match found, store the outer HTML of the anchor tag.
- $link_code = $a->outertext;
- $errors[] = $link_code;
- // No need to check other extensions for this link.
- break;
- }
- }
- }
- }
- return $errors;
-}
diff --git a/includes/rules/link_pdf.php b/includes/rules/link_pdf.php
deleted file mode 100644
index 62bd9bd7..00000000
--- a/includes/rules/link_pdf.php
+++ /dev/null
@@ -1,32 +0,0 @@
-find( 'a' );
-
- foreach ( $as as $a ) {
-
- if ( $a->getAttribute( 'href' ) ) {
- if ( strpos( strtolower( $a ), '.pdf' ) ) {
- $link_code = $a;
-
- $errors[] = $link_code;
- }
- }
- }
- return $errors;
-}
diff --git a/package.json b/package.json
index b0ae2c0c..bbc421b3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "accessibility-checker",
- "version": "1.16.1",
+ "version": "1.16.2",
"description": "Audit and check your website for accessibility before you hit publish. In-post accessibility scanner and guidance.",
"author": "Equalize Digital",
"license": "GPL-2.0+",
diff --git a/readme.txt b/readme.txt
index 1c2003aa..55bce39f 100644
--- a/readme.txt
+++ b/readme.txt
@@ -3,7 +3,7 @@ Contributors: equalizedigital, alh0319, stevejonesdev
Tags: accessibility, accessible, wcag, ada, WP accessibility
Requires at least: 6.2
Tested up to: 6.7.0
-Stable tag: 1.16.1
+Stable tag: 1.16.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -171,8 +171,16 @@ No, Accessibility Checker runs completely on your server and does not require yo
== Changelog ==
+= 1.16.2 =
+
+* Enhancement: Use better names for fix modal titles.
+* Enhancement: Improve the link_pdf rule to detect more accurately.
+* Enhancement: Improve the link_ms_office_doc rule to detect more accurately.
+* Fixed: Rely on labels for link_ambiguous_text rule first before checking just the text content.
+* Fixed: Remove a duplicatable rule empty_form_label.
+
= 1.16.1 =
-* Fix: Remove redundant empty_form_label rule definition.
+* Fixed: Remove redundant empty_form_label rule definition.
= 1.16.0 =
* New: Introduced a system to handle automated fixes for issues that the scanner would discover.
@@ -191,9 +199,9 @@ No, Accessibility Checker runs completely on your server and does not require yo
* Enhancement: Improve the document title check to check on fully rendered pages.
* Enhancement: Add a clear button to the editor to allow for .
* Enhancement: Improved GTM iframe detection.
-* Fix: Avoid showing 100% passed results when scans are not complete.
-* Fix: Improve or add better aria-labels in several places.
-* Fix: Don't flag empty paragraphs if they have aria-hidden.
+* Fixed: Avoid showing 100% passed results when scans are not complete.
+* Fixed: Improve or add better aria-labels in several places.
+* Fixed: Don't flag empty paragraphs if they have aria-hidden.
= 1.15.3 =
* Enhancement: Detect missing labels on more elements.
@@ -214,46 +222,5 @@ No, Accessibility Checker runs completely on your server and does not require yo
* Fixed: Handle stacking contexts for callout button in admin correctly
* Fixed: PHP 8.4 deprecation notice fix for implicitly nullable Meta_Boxes
-= 1.14.3 =
-* Fixed: Allow empty_link rule to detect actually empty links
-
-= 1.14.2 =
-* Enhancement: Reduce false positives for underlined text check
-* Fixed: Frontend highlighter could not be moved to the right side of the window on mobile
-* Fixed: Issue where ignores were not being saved and failing silently
-
-= 1.14.1 =
-* Fixed: Prevent settings page layout issue
-
-= 1.14.0 =
-* Added: Option to move front-end highlighter to opposite side of the window
-* Fixed: Prevent image from overspilling container in issue view
-* Fixed: Make empty paragraph check more accurate
-* Enhancement: Improved styling for settings page
-* Enhancement: Updated summary widget with better semantics
-* Enhancement: Improved aria labeling for view on page links
-* Enhancement: Added large batch processing capabilities for issue ignoring
-
-= 1.13.1 =
-* Enhancement: Make the new window warning detection less rigid
-* Fixed: Avoid flagging possible headings when the entire text is not wrapped
-* Fixed: Allow JS checked rules to retain ignored state between scans
-
-= 1.13.0 =
-* Added: Meta Viewport zoom-able and scale-able check
-* Added: Empty Paragraph warning
-* Fixed: Properly determine possible headings with computed styles
-* Improved: Better detection of the underlined text
-* Improved: Better detection of small text
-* Improved: Better detection of justified text
-* Improved: Better detection of blink and marquee tags
-* Improved: No longer flagging GTM iframes as missing title since they are display: none and visibility: hidden
-* Enhancement: Do not show 'View on page' link to frontend when the issues cannot be viewed
-
-= 1.12.0 =
-* Fixed: Use the last generation time in summary widgets rather than last completed scan time
-* Improved: More accessible panels in the editor
-* Improved: Filter and action docs added/improved
-
Older versions can be found in the plugins `changelog.txt`.
diff --git a/src/admin/summary/summary-tab-input-event-handlers.js b/src/admin/summary/summary-tab-input-event-handlers.js
index db1bb89b..4ca766dd 100644
--- a/src/admin/summary/summary-tab-input-event-handlers.js
+++ b/src/admin/summary/summary-tab-input-event-handlers.js
@@ -139,9 +139,16 @@ export const initFixButtonEventHandlers = () => {
fixSettings.classList.toggle( 'active' );
document.querySelector( 'body' ).classList.add( 'edac-fix-modal-present' );
+ // try to find a fancy name for the modal
+ const fancyNameEl = fixSettings.querySelector( '[data-fancy-name]' );
+ let modalTitle = __( 'Fix Settings', 'accessibility-checker' );
+ if ( fancyNameEl && fancyNameEl.getAttribute( 'data-fancy-name' ).length > 0 ) {
+ modalTitle = fancyNameEl.getAttribute( 'data-fancy-name' );
+ }
+
// trigger a thickbox that contains the contents of the fixSettings
// eslint-disable-next-line no-undef
- tb_show( __( 'Fix Settings', 'accessibility-checker' ), '#TB_inline?width=750&inlineId=' + fixSettings.id );
+ tb_show( modalTitle, '#TB_inline?width=750&inlineId=' + fixSettings.id );
const thickbox = document.getElementById( 'TB_window' );
thickbox.querySelector( '[aria-live]' ).innerText = '';
diff --git a/src/pageScanner/checks/has-ambiguous-text.js b/src/pageScanner/checks/has-ambiguous-text.js
index 8538d481..7f6df24f 100644
--- a/src/pageScanner/checks/has-ambiguous-text.js
+++ b/src/pageScanner/checks/has-ambiguous-text.js
@@ -33,11 +33,6 @@ const checkAmbiguousPhrase = ( text ) => {
export default {
id: 'has_ambiguous_text',
evaluate: ( node ) => {
- const textContent = node.textContent;
- if ( checkAmbiguousPhrase( textContent ) ) {
- return true;
- }
-
if ( node.hasAttribute( 'aria-label' ) ) {
const ariaLabel = node.getAttribute( 'aria-label' );
return checkAmbiguousPhrase( ariaLabel );
@@ -49,6 +44,10 @@ export default {
return checkAmbiguousPhrase( labelText );
}
+ if ( node.textContent && node.textContent !== '' ) {
+ return checkAmbiguousPhrase( node.textContent );
+ }
+
const images = node.querySelectorAll( 'img' );
for ( const image of images ) {
const altText = image.getAttribute( 'alt' );
diff --git a/src/pageScanner/index.js b/src/pageScanner/index.js
index d90c8552..a25fd24d 100644
--- a/src/pageScanner/index.js
+++ b/src/pageScanner/index.js
@@ -22,10 +22,12 @@ import brokenAnchorLink from './rules/broken-anchor-link';
import anchorExists from './checks/anchor-exists';
import labelExtended from './rules/extended/label';
import imageInputHasAlt from './checks/image-input-has-alt';
+import linkPDF from './rules/link-pdf';
+import linkMsOfficeFile from './rules/link-ms-office-file';
//TODO: examples:
//import customRule1 from './rules/custom-rule-1';
-//import alwaysFail from './checks/always-fail';
+import alwaysFail from './checks/always-fail';
//TODO:
//see: https://github.com/dequelabs/axe-core/blob/develop/doc/developer-guide.md#api-reference
@@ -62,11 +64,13 @@ const scan = async (
textJustified,
linkTargetBlank,
linkAmbiguousText,
+ linkPDF,
+ linkMsOfficeFile,
brokenAnchorLink,
labelExtended,
],
checks: [
- //alwaysFail,
+ alwaysFail,
elementIsAUTag,
elementWithUnderline,
paragraphStyledAsHeader,
@@ -101,6 +105,8 @@ const scan = async (
textJustified.id,
linkTargetBlank.id,
linkAmbiguousText.id,
+ linkPDF.id,
+ linkMsOfficeFile.id,
brokenAnchorLink.id,
labelExtended.id,
],
diff --git a/src/pageScanner/rules/link-ms-office-file.js b/src/pageScanner/rules/link-ms-office-file.js
new file mode 100644
index 00000000..7d73fba3
--- /dev/null
+++ b/src/pageScanner/rules/link-ms-office-file.js
@@ -0,0 +1,26 @@
+/**
+ * Detects linked MS Office files.
+ */
+
+const msOfficeFileExtensions = [ '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pps', '.ppsx' ];
+
+// This generates a very long list of selectors, 6 in total for each extension: extension at the end,
+// extension within having query vars, extension within having #anchors plus uppercase versions of the
+// file extension for each one of these cases. It is still quicker that iterating through all the links
+// on the page and checking the href in a matches.
+const selectorString = msOfficeFileExtensions.map( ( extension ) => `a[href$="${ extension }"], a[href$="${ extension.toUpperCase() }"], a[href*="${ extension }?"], a[href*="${ extension.toUpperCase() }?"], a[href*="${ extension }#"], a[href*="${ extension.toUpperCase() }#"]` ).join( ', ' );
+
+export default {
+ id: 'link_ms_office_file',
+ selector: selectorString,
+ excludeHidden: false,
+ tags: [
+ 'cat.custom',
+ ],
+ metadata: {
+ description: 'Links to MS Office documents typically should be checked.',
+ },
+ all: [],
+ any: [ 'always-fail' ],
+ none: [],
+};
diff --git a/src/pageScanner/rules/link-pdf.js b/src/pageScanner/rules/link-pdf.js
new file mode 100644
index 00000000..84e064b9
--- /dev/null
+++ b/src/pageScanner/rules/link-pdf.js
@@ -0,0 +1,17 @@
+/**
+ * Detects linked PDFs.
+ */
+export default {
+ id: 'link_pdf',
+ selector: 'a[href$=".pdf"], a[href$=".PDF"], a[href*=".pdf?"], a[href*=".PDF?"], a[href*=".pdf#"], a[href*=".PDF#"]',
+ excludeHidden: false,
+ tags: [
+ 'cat.custom',
+ ],
+ metadata: {
+ description: 'Links to PDFs typically should be checked.',
+ },
+ all: [],
+ any: [ 'always-fail' ],
+ none: [],
+};