diff --git a/lms/static/js/student_account/views/RegisterView.js b/lms/static/js/student_account/views/RegisterView.js index c0bb0337c7..034f113e55 100644 --- a/lms/static/js/student_account/views/RegisterView.js +++ b/lms/static/js/student_account/views/RegisterView.js @@ -327,8 +327,10 @@ error = isCheckbox ? '' : decisions.validation_decisions[name]; if (hasError && this.negativeValidationEnabled) { + this.addValidationErrorMsgForScreenReader($el); this.renderLiveValidationError($el, $label, $requiredTextLabel, $icon, $errorTip, error); } else if (this.positiveValidationEnabled) { + this.removeValidationErrorMsgForScreenReader($el); this.renderLiveValidationSuccess($el, $label, $requiredTextLabel, $icon, $errorTip); } }, @@ -341,6 +343,16 @@ return $('#' + $el.attr('id') + '-validation-icon'); }, + addValidationErrorMsgForScreenReader: function($el) { + var $validation_node = this.$form.find('#' + $el.attr('id') + '-validation-error'); + $validation_node.find('.sr-only').text('ERROR:'); + }, + + removeValidationErrorMsgForScreenReader: function($el) { + var $validation_node = this.$form.find('#' + $el.attr('id') + '-validation-error'); + $validation_node.find('.sr-only').text(''); + }, + getErrorTip: function($el) { return $('#' + $el.attr('id') + '-validation-error-msg'); }, diff --git a/lms/templates/student_account/form_field.underscore b/lms/templates/student_account/form_field.underscore index 52a3f8af89..4fd26e7eb7 100644 --- a/lms/templates/student_account/form_field.underscore +++ b/lms/templates/student_account/form_field.underscore @@ -39,7 +39,7 @@ <% }); %> - ERROR: + <% if ( instructions ) { %> <%- instructions %><% } %> @@ -65,7 +65,7 @@ } %> <% if ( required ) { %> aria-required="true" required<% } %>> - ERROR: + <% if ( instructions ) { %> <%- instructions %><% } %> @@ -126,7 +126,7 @@ <% } %> - ERROR: + <% if ( instructions ) { %> <%- instructions %><% } %>