Skip to content

Commit 450614b

Browse files
RoyEJohnsonmwvolo
andauthored
CORE-980: fix email error message (#1640)
[CORE-980] Add alert role and id to error message Add aria-invalid and aria-errormessage to the field Remove <b> tags (that don't work) from messages Co-authored-by: Michael Volo <[email protected]>
1 parent dd5439b commit 450614b

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

app/assets/stylesheets/controls/_card.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
section,
136136
.warning,
137137
.form-group {
138-
& + *:not(.footer):not(.alert):not(.warning):not(.errors) {
138+
& + *:not(.footer):not(.alert):not(.warning):not(.errors):not(.help-block) {
139139
margin-top: $os-section-spacing;
140140
}
141141
}

config/locales/activerecord.en.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ en:
132132
attributes:
133133
# Marking &email_address for reference later.
134134
value: &email_addres_validations
135-
invalid: <b>%{value}</b> is not a valid email address
136-
missing_mx_records: <b>%{value}</b> is not a valid email address
135+
invalid: "%{value} is not a valid email address"
136+
missing_mx_records: "%{value} is not a valid email address"
137137
too_many_dots: This email has too many dots in a row
138138
ends_with_dot: An email cannot end with a dot
139139
contains_tick: An email should not contain a tick (`)

config/locales/activerecord.pl.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ pl:
135135
email_address:
136136
attributes:
137137
value: &email_address_validations
138-
invalid: <b>%{value}</b> nie jest poprawnym adresem e-mail
139-
missing_mx_records: <b>%{value}</b> nie jest poprawnym adresem e-mail
138+
invalid: "%{value} nie jest poprawnym adresem e-mail"
139+
missing_mx_records: "%{value} nie jest poprawnym adresem e-mail"
140140
too_many_dots: Adres e-mail ma zbyt wiele kropek pod rząd
141141
ends_with_dot: Adres e-mail nie może kończyć się kropką
142142
contains_tick: Adres e-mail nie może zawierać znaku „`”

vendor/assets/javascripts/bootstrap-editable.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
181181

182182
if(msg === false) {
183183
$group.removeClass($.fn.editableform.errorGroupClass);
184-
$block.removeClass($.fn.editableform.errorBlockClass).empty().hide();
184+
$block.removeClass($.fn.editableform.errorBlockClass).empty().hide();
185+
// Customized by OpenStax for accessibility
186+
$group.find('input').removeAttr('aria-invalid aria-errormessage');
185187
} else {
186188
//convert newline to <br> for more pretty error display
187189
if(msg) {
@@ -193,6 +195,9 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
193195
}
194196
$group.addClass($.fn.editableform.errorGroupClass);
195197
$block.addClass($.fn.editableform.errorBlockClass).html(msg).show();
198+
// Customized by OpenStax for accessibility
199+
$group.find('input').attr('aria-errormessage', $block.attr('id'))
200+
.attr('aria-invalid', 'true');
196201
}
197202
},
198203

@@ -617,7 +622,8 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
617622
$.fn.editableform.template = '<form class="form-inline editableform">'+
618623
'<div class="control-group">' +
619624
'<label><div class="editable-input"></div><div class="editable-buttons"></div></div>'+
620-
'<div class="editable-error-block"></div>' +
625+
// Customized by OpenStax for accessibility
626+
'<div class="editable-error-block" role="alert" id="editable-alert"></div>' +
621627
'</label>' +
622628
'</form>';
623629

0 commit comments

Comments
 (0)