diff --git a/framework/assets/yii.activeForm.js b/framework/assets/yii.activeForm.js index d12270bd73..a37e727872 100644 --- a/framework/assets/yii.activeForm.js +++ b/framework/assets/yii.activeForm.js @@ -170,7 +170,7 @@ // the value of the input value: undefined, // whether to toggle aria-invalid attribute after validation - ariaInvalidToggle: true + updateAriaInvalid: true }; @@ -779,7 +779,7 @@ }; var toggleAriaInvalid = function ($form, attribute, hasError) { - if (attribute.ariaInvalidToggle) { + if (attribute.updateAriaInvalid) { $form.find(attribute.input).attr('aria-invalid', hasError ? 'true' : 'false'); } } diff --git a/framework/widgets/ActiveField.php b/framework/widgets/ActiveField.php index 1035fb93de..7ce67ecbf3 100644 --- a/framework/widgets/ActiveField.php +++ b/framework/widgets/ActiveField.php @@ -164,9 +164,9 @@ class ActiveField extends Component private $_skipLabelFor = false; /** - * @var bool whether `aria-invalid` HTML attribute should be toggled by validation on client + * @var bool whether `aria-invalid` HTML attribute should be updated by client validation */ - private $_skipClientAriaInvalid = true; + private $_updateAriaInvalidOnClient = true; /** @@ -803,8 +803,8 @@ class ActiveField extends Component $options['validate'] = new JsExpression("function (attribute, value, messages, deferred, \$form) {" . implode('', $validators) . '}'); } - if ($this->addAriaAttributes === false && !$this->_skipClientAriaInvalid) { - $options['ariaInvalidToggle'] = false; + if ($this->addAriaAttributes === false || !$this->_updateAriaInvalidOnClient) { + $options['updateAriaInvalid'] = false; } // only get the options that are different from the default ones (set in yii.activeForm.js) @@ -815,7 +815,7 @@ class ActiveField extends Component 'validationDelay' => 500, 'encodeError' => true, 'error' => '.help-block', - 'ariaInvalidToggle' => true, + 'updateAriaInvalid' => true, ]); } @@ -865,7 +865,7 @@ class ActiveField extends Component if ($this->model->hasErrors($this->attribute)) { $options['aria-invalid'] = 'true'; } - $this->_skipClientAriaInvalid = false; + $this->_updateAriaInvalidOnClient = false; } } }