Skip to content

Commit

Permalink
Merge pull request #804 from equalizedigital/release/1.16.0
Browse files Browse the repository at this point in the history
Release/1.16.0
  • Loading branch information
pattonwebz authored Oct 30, 2024
2 parents df014ad + 7ad73d1 commit a1e2f82
Show file tree
Hide file tree
Showing 22 changed files with 105 additions and 25 deletions.
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.16.0-RC1
* Version: 1.16.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.16.0-RC1' );
define( 'EDAC_VERSION', '1.16.0' );
}

// Current database version.
Expand Down
3 changes: 2 additions & 1 deletion admin/AdminPage/FixesSettingType/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static function checkbox( $args ) {
<?php echo $upsell ? 'disabled' : ''; ?>
<?php echo isset( $args['fix_slug'] ) ? 'data-fix-slug="' . esc_attr( $args['fix_slug'] ) . '"' : ''; ?>
<?php echo isset( $args['group_name'] ) ? 'data-group-name="' . esc_attr( $args['group_name'] ) . '"' : ''; ?>
<?php echo isset( $args['fancy_name'] ) ? 'data-fancy-name="' . esc_attr( $args['fancy_name'] ) . '"' : ''; ?>
/>
<?php if ( isset( $args['location'] ) && $upsell ) : ?>
<a class="edac-fix--upsell-link"
Expand All @@ -47,7 +48,7 @@ public static function checkbox( $args ) {
<?php endif; ?>
<?php echo wp_kses( $args['description'], [ 'code' => [] ] ); ?>
<?php
if ( isset( $args['help_id'] ) && $args['label'] ) :
if ( isset( $args['help_id'] ) && ! empty( $args['help_id'] ) && $args['label'] ) :
$link = \edac_generate_link_type(
[
'utm-content' => 'fix-description',
Expand Down
2 changes: 1 addition & 1 deletion admin/AdminPage/FixesSettingType/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static function text( $args ) {
><?php esc_html_e( 'Get Pro', 'accessibility-checker' ); ?></a> <?php endif; ?>
<?php echo wp_kses( $args['description'], [ 'code' => [] ] ); ?>
<?php
if ( isset( $args['help_id'] ) && $args['label'] ) :
if ( isset( $args['help_id'] ) && ! empty( $args['help_id'] ) && $args['label'] ) :
$link = \edac_generate_link_type(
[
'utm-content' => 'fix-description',
Expand Down
3 changes: 2 additions & 1 deletion admin/class-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ function ( $a, $b ) {
if ( ! empty( $fixes_for_item ) ) {
$html .= sprintf(
'<button class="edac-details-rule-records-record-actions-fix"
aria-haspopup="true"
aria-controls="%1$s"
aria-label="%2$s"
type="button"
Expand All @@ -508,7 +509,7 @@ function ( $a, $b ) {
%3$s
</button>',
esc_attr( $controls_id ),
esc_attr( __( 'Open modal of fix settings related to: ', 'accessibility-checker' ) . $rule['title'] ),
esc_attr( __( 'Fix: ', 'accessibility-checker' ) . $fixes_for_item[0]->get_nicename() ),
esc_html__( 'Fix', 'accessibility-checker' )
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ public static function get_slug(): string {
* @return string
*/
public static function get_nicename(): string {
return __( 'Add Size & Type To File Links', 'accessibility-checker' );
}

/**
* The nicename for the fix.
*
* @return string
*/
public static function get_fancyname(): string {
return __( 'Add Context to Linked Files', 'accessibility-checker' );
}

Expand Down
10 changes: 10 additions & 0 deletions includes/classes/Fixes/Fix/AddLabelToUnlabelledFormFieldsFix.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ public static function get_slug(): string {
* @return string
*/
public static function get_nicename(): string {
return __( 'Add Size & Type To File Links', 'accessibility-checker' );
}

/**
* The fancyname for the fix.
*
* @return string
*/
public static function get_fancyname(): string {
return __( 'Label Form Fields', 'accessibility-checker' );
}

Expand Down Expand Up @@ -84,6 +93,7 @@ public function get_fields_array( array $fields = [] ): array {
'section' => $this->get_slug(),
'upsell' => isset( $this->is_pro ) && $this->is_pro ? false : true,
'group_name' => $this->get_nicename(),
'fancy_name' => $this->get_fancyname(),
'fix_slug' => $this->get_slug(),
'help_id' => 8497,
];
Expand Down
9 changes: 9 additions & 0 deletions includes/classes/Fixes/Fix/AddMissingOrEmptyPageTitleFix.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ public static function get_slug(): string {
* @return string
*/
public static function get_nicename(): string {
return __( 'Add Missing or Empty Page Titles', 'accessibility-checker' );
}

/**
* The fancyname for the fix.
*
* @return string
*/
public static function get_fancyname(): string {
return __( 'Set Page HTML Titles', 'accessibility-checker' );
}

Expand Down
25 changes: 17 additions & 8 deletions includes/classes/Fixes/Fix/CommentSearchLabelFix.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ public static function get_slug(): string {
* @return string
*/
public static function get_nicename(): string {
return __( 'Add Labels to Comment and Search Forms', 'accessibility-checker' );
}

/**
* The nicename for the fix.
*
* @return string
*/
public static function get_fancyname(): string {
return __( 'Label Comment/Search Fields', 'accessibility-checker' );
}

Expand Down Expand Up @@ -85,7 +94,7 @@ public function get_fields_array( array $fields = [] ): array {
'section' => 'comment_search_label',
'fix_slug' => $this->get_slug(),
'group_name' => $this->get_nicename(),
'help_id' => 8497,
'help_id' => 8658,
];

$fields['edac_fix_search_label'] = [
Expand All @@ -95,7 +104,7 @@ public function get_fields_array( array $fields = [] ): array {
'description' => esc_html__( 'Add a missing label to the WordPress search form.', 'accessibility-checker' ),
'section' => 'comment_search_label',
'fix_slug' => $this->get_slug(),
'help_id' => 8497,
'help_id' => 8659,
];

return $fields;
Expand Down Expand Up @@ -126,22 +135,22 @@ public function fix_comment_form_labels( $defaults ): array {

// Check if the comment label is set correctly; if not, fix it.
if ( empty( $defaults['comment_field'] ) || ! strpos( $defaults['comment_field'], '<label' ) ) {
$defaults['comment_field'] = '<p class="comment-form-comment"><label for="comment">' . esc_html__( 'Comment', 'accessibility-checker' ) . '</label><textarea id="comment" name="comment" rows="4" required></textarea></p>';
$defaults['comment_field'] = '<p class="comment-form-comment"><label for="comment" class="edac-generated-label">' . esc_html__( 'Comment', 'accessibility-checker' ) . '</label><textarea id="comment" name="comment" rows="4" required></textarea></p>';
}

// Check the author field label.
if ( isset( $defaults['fields']['author'] ) && ! strpos( $defaults['fields']['author'], '<label' ) ) {
$defaults['fields']['author'] = '<p class="comment-form-author"><label for="author">' . esc_html__( 'Name', 'accessibility-checker' ) . '</label><input id="author" name="author" type="text" value="" size="30" required /></p>';
$defaults['fields']['author'] = '<p class="comment-form-author"><label for="author" class="edac-generated-label">' . esc_html__( 'Name', 'accessibility-checker' ) . '</label><input id="author" name="author" type="text" value="" size="30" required /></p>';
}

// Check the email field label.
if ( isset( $defaults['fields']['email'] ) && ! strpos( $defaults['fields']['email'], '<label' ) ) {
$defaults['fields']['email'] = '<p class="comment-form-email"><label for="email">' . esc_html__( 'Email', 'accessibility-checker' ) . '</label><input id="email" name="email" type="email" value="" size="30" required /></p>';
$defaults['fields']['email'] = '<p class="comment-form-email"><label for="email" class="edac-generated-label">' . esc_html__( 'Email', 'accessibility-checker' ) . '</label><input id="email" name="email" type="email" value="" size="30" required /></p>';
}

// Check the website field label.
if ( isset( $defaults['fields']['url'] ) && ! strpos( $defaults['fields']['url'], '<label' ) ) {
$defaults['fields']['url'] = '<p class="comment-form-url"><label for="url">' . esc_html__( 'Website', 'accessibility-checker' ) . '</label><input id="url" name="url" type="url" value="" size="30" /></p>';
$defaults['fields']['url'] = '<p class="comment-form-url"><label for="url" class="edac-generated-label">' . esc_html__( 'Website', 'accessibility-checker' ) . '</label><input id="url" name="url" type="url" value="" size="30" /></p>';
}

return $defaults;
Expand All @@ -165,12 +174,12 @@ public function fix_search_form_label( $form ): string {
$input_id = $input_matches[1]; // Use the existing id of the input field.
} else {
$input_id = 'search-form-' . uniqid(); // Generate a unique ID if the input field doesn't have one.
$input_field = '<input type="search" id="' . esc_attr( $input_id ) . '" class="search-field" placeholder="' . esc_attr__( 'Search …', 'accessibility-checker' ) . '" value="' . get_search_query() . '" name="s" />';
$input_field = '<input type="search" id="' . esc_attr( $input_id ) . '" class="search-field edac-generated-label" placeholder="' . esc_attr__( 'Search …', 'accessibility-checker' ) . '" value="' . get_search_query() . '" name="s" />';
}

// Rebuild the form with a visible <label> and ensure the "for" attribute matches the input's id.
$form = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '">
<label for="' . esc_attr( $input_id ) . '">' . esc_html__( 'Search for:', 'accessibility-checker' ) . '</label>
<label for="' . esc_attr( $input_id ) . '" class="edac-generated-label" >' . esc_html__( 'Search for:', 'accessibility-checker' ) . '</label>
' . $input_field . '
<button type="submit" class="search-submit">' . esc_attr__( 'Search', 'accessibility-checker' ) . '</button>
</form>';
Expand Down
9 changes: 9 additions & 0 deletions includes/classes/Fixes/Fix/HTMLLangAndDirFix.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ public static function get_slug(): string {
* @return string
*/
public static function get_nicename(): string {
return __( 'Add lang & dir Attributes', 'accessibility-checker' );
}

/**
* The nicename for the fix.
*
* @return string
*/
public static function get_fancyname(): string {
return __( 'Set Page Language', 'accessibility-checker' );
}

Expand Down
9 changes: 9 additions & 0 deletions includes/classes/Fixes/Fix/LinkUnderline.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ public static function get_slug(): string {
* @return string
*/
public static function get_nicename(): string {
return __( 'Add Underlines to all non-nav Links', 'accessibility-checker' );
}

/**
* The nicename for the fix.
*
* @return string
*/
public static function get_fancyname(): string {
return __( 'Underline Links', 'accessibility-checker' );
}

Expand Down
2 changes: 1 addition & 1 deletion includes/classes/Fixes/Fix/MetaViewportScalableFix.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function ( $sections ) {
*/
public function get_fields_array( array $fields = [] ): array {
$fields[ 'edac_fix_' . $this->get_slug() ] = [
'label' => esc_html__( 'Scalable Viewport Tag', 'accessibility-checker' ),
'label' => esc_html__( 'Make Viewport Scalable', 'accessibility-checker' ),
'type' => 'checkbox',
'labelledby' => '',
'description' => esc_html__( 'Ensure the viewport tag allows for scaling, enhancing accessibility on mobile devices.', 'accessibility-checker' ),
Expand Down
12 changes: 11 additions & 1 deletion includes/classes/Fixes/Fix/ReadMoreAddTitleFix.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@ public static function get_slug(): string {
* @return string
*/
public static function get_nicename(): string {
return __( 'Add Title to Read More Links', 'accessibility-checker' );
return __( 'Add "Read" Link with Post Title', 'accessibility-checker' );
}

/**
* The nicename for the fix.
*
* @return string
*/
public static function get_fancyname(): string {
return __( 'Add Title to Read More Link', 'accessibility-checker' );
}

/**
Expand Down Expand Up @@ -85,6 +94,7 @@ public function get_fields_array( array $fields = [] ): array {
'section' => 'read_more_links',
'fix_slug' => $this->get_slug(),
'group_name' => $this->get_nicename(),
'help_id' => 8663,
];

$fields['edac_fix_add_read_more_title_screen_reader_only'] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ public static function get_slug(): string {
* @return string
*/
public static function get_nicename(): string {
return __( 'Prefer Accessible Label Attribute', 'accessibility-checker' );
}

/**
* The nicename for the fix.
*
* @return string
*/
public static function get_fancyname(): string {
return __( 'Remove Unnecessary Title Attributes', 'accessibility-checker' );
}

Expand Down
1 change: 1 addition & 0 deletions includes/classes/Fixes/Fix/SkipLinkFix.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public function get_fields_array( array $fields = [] ): array {
'section' => 'skip_link',
'fix_slug' => $this->get_slug(),
'group_name' => $this->get_nicename(),
'help_id' => 8638,
];

$fields['edac_fix_add_skip_link_target_id'] = [
Expand Down
1 change: 0 additions & 1 deletion includes/classes/Fixes/FixesManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ private function load_fixes() {
SkipLinkFix::class,
CommentSearchLabelFix::class,
HTMLLangAndDirFix::class,
ReadMoreAddTitleFix::class,
TabindexFix::class,
RemoveTitleIfPrefferedAccessibleNameFix::class,
LinkUnderline::class,
Expand Down
3 changes: 0 additions & 3 deletions includes/rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,6 @@
'rule_type' => 'error',
'summary' => esc_html__( 'Ambiguous Anchor Text errors appear when there is linked text that has no meaning outside of its surrounding content. Common examples of this include linking phrases like "click here" or "learn more." To resolve this error, change the link text to be less generic so that it has meaning if heard on its own.', 'accessibility-checker' ),
'ruleset' => 'js',
'fixes' => [
ReadMoreAddTitleFix::get_slug(),
],
],
[
'title' => esc_html__( 'Underlined Text', 'accessibility-checker' ),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "accessibility-checker",
"version": "1.16.0-RC1",
"version": "1.16.0",
"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+",
Expand Down
1 change: 0 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ No, Accessibility Checker runs completely on your server and does not require yo
* New: Fix to remove or update bad tabindex values on elements.
* New: Fix to remove title attributes in favor of preferred accessible names to elements.
* New: Fix to add missing lang and dir attributes to the <html> element.
* New: Fix to add post titles to 'read more' links to disambiguate them.
* New: Fix to add skip links to pages where they are missing.
* New: Fix to add labels to comment and search forms.
* New: Fix to ensure that the meta viewport tag does not prevent user scaling or zooming.
Expand Down
5 changes: 5 additions & 0 deletions src/common/sass/_fix-settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -274,4 +274,9 @@ body.block-editor-page {
.hide-in-editor {
display: none;
}

.modal-opening-message {
margin: 0;
padding: 0;
}
}
9 changes: 6 additions & 3 deletions src/frontendHighlighterApp/fixesModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,17 @@ export const fillFixesModal = ( content = '', fieldsElement = '' ) => {
// put the fieldsElement inside the fieldsWrapper element
fieldsWrapper.appendChild( fieldsElement );

// find a data-group-name in the fields
const groupName = fieldsWrapper.querySelector( '[data-group-name]' )?.getAttribute( 'data-group-name' ) || '';
// find a fancyName or groupName in the fields.
let fancyName = fieldsWrapper.querySelector( '[data-fancy-name]' )?.getAttribute( 'data-fancy-name' ) || '';
if ( fancyName === '' ) {
fancyName = fieldsWrapper.querySelector( '[data-group-name]' )?.getAttribute( 'data-group-name' ) || '';
}

const modal = document.getElementById( 'edac-fixes-modal' );
const modalTitle = modal.querySelector( '#edac-fixes-modal-title' );
const modalBody = modal.querySelector( '.edac-fixes-modal__body' );

modalTitle.innerText = groupName;
modalTitle.innerText = fancyName;
modalBody.innerHTML = content;
modalBody.appendChild( fieldsWrapper );

Expand Down
1 change: 0 additions & 1 deletion src/frontendHighlighterApp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,6 @@ class AccessibilityCheckerHighlight {
<button role="button"
class="edac-fix-settings--button--open edac-highlight-panel-description--button"
aria-haspopup="true"
aria-expanded="false"
aria-controls="edac-highlight-panel-description-fix"
aria-label="Fix issue: ${ this.fixes[ matchingObj.slug ][ Object.keys( this.fixes[ matchingObj.slug ] )[ 0 ] ].group_name }"> Fix Issue</button>`;
} else {
Expand Down
1 change: 1 addition & 0 deletions src/frontendHighlighterApp/sass/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ body {
}

.modal-opening-message {
display: inline-block;
margin-bottom: 0.5em !important;
}

Expand Down

0 comments on commit a1e2f82

Please sign in to comment.