Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<template data-sly-template.errorMessage="${@ componentId, bemBlock}">
<div class="${bemBlock}__errormessage" id="${componentId}__errormessage" aria-live="assertive"></div>
<div class="${bemBlock}__errormessage" id="${componentId}__errormessage" aria-live="assertive" tabindex=0 role="complementary"></div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabindex needs to be set dynamically, depending on error at runtime on field, if there is no error then it should be -1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will revert this file to original and update the logic in FormFieldBase.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code updated.

</template>
4 changes: 3 additions & 1 deletion ui.frontend/src/view/FormFieldBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class FormFieldBase extends FormField {
#syncLabel() {
let labelElement = typeof this.getLabel === 'function' ? this.getLabel() : null;
if (labelElement) {
labelElement.setAttribute('id', `${this.getId()}__label`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this id

labelElement.setAttribute('for', this.getWidgetId());
}
}
Expand All @@ -176,6 +177,7 @@ class FormFieldBase extends FormField {
let errorElement = typeof this.getErrorDiv === 'function' ? this.getErrorDiv() : null;
if (errorElement) {
errorElement.setAttribute('id', `${this.getId()}__errormessage`);
errorElement.setAttribute('aria-describedby', `${this.getId()}__label`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is already present in the input field. We can not use the aria-describedby attribute on the error container.

}
}

Expand Down Expand Up @@ -249,7 +251,7 @@ class FormFieldBase extends FormField {
this.#syncLabel()
this.#syncWidget()
this.#syncShortDesc()
this. #syncLongDesc()
this.#syncLongDesc()
this.#syncAriaDescribedBy()
this.#syncError()
this.#syncAriaLabel()
Expand Down