Skip to content

Commit

Permalink
Added role="alert" to errors on forms for better accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mahype committed Jul 10, 2019
1 parent 13b7f71 commit 49c3c73
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ You can also contribute to the plugin by translating it. Simply visit [translate
* Enhanced: Changed standard export type to one column for choices for better readability in mails
* Enhanced: Changed order of reCaptcha to the end of protectors list, because it's 3rd pary
* Enhanced: Added hint if reCaptcha is not configured properly
* Enhanced: Moved description before HTML inputs
* Enhanced: Added role="alert" to errors on forms for better accessibility
* Fixed: Added wrapper for buggy filter_input PHP function
* Fixed: Plugin-Lib throws notice for datetime fields
* Fixed: Compact PHP function in PHP 7.3 throws error
Expand Down
2 changes: 1 addition & 1 deletion src/templates/element-checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<?php endif; ?>

<?php if ( ! empty( $errors ) ) : ?>
<ul<?php echo torro()->template()->attrs( $errors_attrs ); ?>>
<ul<?php echo torro()->template()->attrs( $errors_attrs ); ?> role="alert">
<?php foreach ( $errors as $error_code => $error_message ) : ?>
<li><?php echo torro()->template()->esc_kses_basic( $error_message ); ?></li>
<?php endforeach; ?>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/element-dropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</select>

<?php if ( ! empty( $errors ) ) : ?>
<ul<?php echo torro()->template()->attrs( $errors_attrs ); ?>>
<ul<?php echo torro()->template()->attrs( $errors_attrs ); ?> role="alert">
<?php foreach ( $errors as $error_code => $error_message ) : ?>
<li><?php echo torro()->template()->esc_kses_basic( $error_message ); ?></li>
<?php endforeach; ?>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/element-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
?>

<?php if ( ! empty( $errors ) ) : ?>
<ul<?php echo torro()->template()->attrs( $errors_attrs ); ?>>
<ul<?php echo torro()->template()->attrs( $errors_attrs ); ?> role="alert">
<?php foreach ( $errors as $error_code => $error_message ) : ?>
<li><?php echo torro()->template()->esc_kses_basic( $error_message ); ?></li>
<?php endforeach; ?>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/element-multiplechoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<?php endforeach; ?>

<?php if ( ! empty( $errors ) ) : ?>
<ul<?php echo torro()->template()->attrs( $errors_attrs ); ?>>
<ul<?php echo torro()->template()->attrs( $errors_attrs ); ?> role="alert">
<?php foreach ( $errors as $error_code => $error_message ) : ?>
<li><?php echo torro()->template()->esc_kses_basic( $error_message ); ?></li>
<?php endforeach; ?>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/element-onechoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<?php endforeach; ?>

<?php if ( ! empty( $errors ) ) : ?>
<ul<?php echo torro()->template()->attrs( $errors_attrs ); ?>>
<ul<?php echo torro()->template()->attrs( $errors_attrs ); ?> role="alert">
<?php foreach ( $errors as $error_code => $error_message ) : ?>
<li><?php echo torro()->template()->esc_kses_basic( $error_message ); ?></li>
<?php endforeach; ?>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/element-textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<textarea<?php echo torro()->template()->attrs( $input_attrs ); ?>><?php echo torro()->template()->esc_textarea( $value ); ?></textarea>

<?php if ( ! empty( $errors ) ) : ?>
<ul<?php echo torro()->template()->attrs( $errors_attrs ); ?>>
<ul<?php echo torro()->template()->attrs( $errors_attrs ); ?> role="alert">
<?php foreach ( $errors as $error_code => $error_message ) : ?>
<li><?php echo torro()->template()->esc_kses_basic( $error_message ); ?></li>
<?php endforeach; ?>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/element-textfield.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<input<?php echo torro()->template()->attrs( $input_attrs ); ?> value="<?php echo torro()->template()->esc_attr( $value ); ?>">

<?php if ( ! empty( $errors ) ) : ?>
<ul<?php echo torro()->template()->attrs( $errors_attrs ); ?>>
<ul<?php echo torro()->template()->attrs( $errors_attrs ); ?> role="alert">
<?php foreach ( $errors as $error_code => $error_message ) : ?>
<li><?php echo torro()->template()->esc_kses_basic( $error_message ); ?></li>
<?php endforeach; ?>
Expand Down

0 comments on commit 49c3c73

Please sign in to comment.