From 610ce60d34d5097abf8789bfd317600f4e2a7259 Mon Sep 17 00:00:00 2001 From: Dmitry Kurmanov Date: Mon, 26 Feb 2024 11:17:46 +0400 Subject: [PATCH] PR: A screen reader (e.g., NVDA) doesn't announce a question's description (#7902) * work for the https://github.com/surveyjs/survey-library/issues/7881 * work for the https://github.com/surveyjs/survey-library/issues/7881 --- .../dropdown/dropdown.component.html | 3 +- .../element-header.component.html | 2 +- .../rating/rating-item-smiley.component.html | 2 +- .../rating/rating-item-star.component.html | 2 +- .../rating/rating-item.component.html | 2 +- .../boolean-checkbox.component.html | 4 +-- .../boolean-radio-item.component.html | 2 +- .../dropdown-select.component.html | 2 +- .../tagbox/tagbox-filter.component.html | 1 + .../components/tagbox/tagbox.component.html | 2 +- .../src/question.component.html | 4 +-- .../src/questions/boolean.component.html | 3 +- .../button-group-item.component.html | 2 +- .../src/questions/comment.component.html | 3 +- .../src/questions/file.component.html | 2 +- .../questions/imagepicker-item.component.html | 2 +- .../src/questions/matrixcell.component.html | 2 +- .../questions/radiogroup-item.component.html | 2 +- .../src/questions/selectbase.component.html | 3 +- .../src/questions/text.component.html | 2 +- .../survey-vue3-ui/src/BooleanCheckbox.vue | 3 +- .../survey-vue3-ui/src/BooleanRadioItem.vue | 2 +- packages/survey-vue3-ui/src/BooleanSwitch.vue | 3 +- packages/survey-vue3-ui/src/Comment.vue | 6 ++-- .../survey-vue3-ui/src/DropdownSelect.vue | 2 +- packages/survey-vue3-ui/src/ElementHeader.vue | 1 + packages/survey-vue3-ui/src/File.vue | 2 +- .../survey-vue3-ui/src/ImagepickerItem.vue | 4 +-- packages/survey-vue3-ui/src/MatrixCell.vue | 2 +- packages/survey-vue3-ui/src/Question.vue | 2 ++ .../survey-vue3-ui/src/RadiogroupItem.vue | 2 +- packages/survey-vue3-ui/src/SelectBase.vue | 3 +- packages/survey-vue3-ui/src/TextInput.vue | 6 ++-- .../src/buttongroup/ButtonGroupItem.vue | 2 +- .../src/components/dropdown/Dropdown.vue | 3 +- .../src/components/rating/RatingItem.vue | 2 +- .../components/rating/RatingItemSmiley.vue | 2 +- .../src/components/rating/RatingItemStar.vue | 2 +- .../src/components/tagbox/Tagbox.vue | 2 +- .../src/components/tagbox/TagboxFilter.vue | 1 + .../boolean-checkbox/boolean-checkbox.html | 4 +-- .../boolean-radio/boolean-radio-item.html | 2 +- .../button-group/button-group-item.html | 2 +- .../dropdown-select/dropdown-select.html | 2 +- .../components/dropdown/dropdown.html | 3 +- .../components/rating/rating-item-smiley.html | 2 +- .../components/rating/rating-item-star.html | 2 +- .../components/rating/rating-item.html | 2 +- src/knockout/components/tagbox/tagbox.html | 3 +- src/knockout/templates/question-boolean.html | 2 +- src/knockout/templates/question-checkbox.html | 2 +- src/knockout/templates/question-comment.html | 2 +- src/knockout/templates/question-file.html | 2 +- .../templates/question-imagepicker.html | 2 +- src/knockout/templates/question-matrix.html | 2 +- .../templates/question-radiogroup.html | 4 +-- src/knockout/templates/question-text.html | 2 +- src/knockout/templates/question.html | 2 +- src/knockout/templates/questioncontent.html | 2 +- src/knockout/templates/questiontitle.html | 2 +- src/question.ts | 21 +++++++++++++- src/question_multipletext.ts | 4 +++ src/react/boolean-checkbox.tsx | 2 +- src/react/boolean-radio.tsx | 2 +- src/react/boolean.tsx | 3 +- .../components/rating/rating-item-smiley.tsx | 2 +- .../components/rating/rating-item-star.tsx | 2 +- src/react/components/rating/rating-item.tsx | 2 +- src/react/dropdown-base.tsx | 3 +- src/react/dropdown-select.tsx | 2 +- src/react/imagepicker.tsx | 2 +- src/react/reactquestion.tsx | 1 + src/react/reactquestion_buttongroup.tsx | 2 +- src/react/reactquestion_checkbox.tsx | 3 +- src/react/reactquestion_comment.tsx | 3 +- src/react/reactquestion_element.tsx | 2 +- src/react/reactquestion_file.tsx | 2 +- src/react/reactquestion_matrix.tsx | 2 +- src/react/reactquestion_radiogroup.tsx | 5 ++-- src/react/reactquestion_tagbox.tsx | 2 +- src/react/reactquestion_text.tsx | 3 +- src/react/tagbox-filter.tsx | 1 + src/survey-element.ts | 1 + src/vue/boolean-checkbox.vue | 3 +- src/vue/boolean-radio-item.vue | 2 +- src/vue/boolean-switch.vue | 3 +- src/vue/buttongroupitem.vue | 2 +- src/vue/checkbox.vue | 3 +- src/vue/comment.vue | 6 ++-- src/vue/components/dropdown/dropdown.vue | 3 +- .../components/rating/rating-item-smiley.vue | 2 +- .../components/rating/rating-item-star.vue | 2 +- src/vue/components/rating/rating-item.vue | 2 +- src/vue/components/tagbox/tagbox-filter.vue | 1 + src/vue/components/tagbox/tagbox.vue | 2 +- src/vue/dropdown-select.vue | 2 +- src/vue/element.vue | 2 ++ src/vue/elementheader.vue | 1 + src/vue/file.vue | 2 +- src/vue/imagepicker-item.vue | 4 +-- src/vue/matrixcell.vue | 2 +- src/vue/radiogroup.vue | 3 +- src/vue/radiogroupitem.vue | 2 +- src/vue/text-input.vue | 6 ++-- tests/a11y.ts | 29 +++++++++++++++---- tests/markup/helper.ts | 2 +- tests/markup/snapshots/boolean-v2.snap.html | 2 +- .../snapshots/boolean-value-v2.snap.html | 2 +- tests/markup/snapshots/boolean.snap.html | 2 +- ...atrixdropdown-cell-errors-bottom.snap.html | 2 +- .../matrixdropdown-cell-errors-top.snap.html | 2 +- .../multipletext-error-bottom-v2.snap.html | 2 +- .../multipletext-error-top-v2.snap.html | 2 +- .../snapshots/page-swnl-title-v2.snap.html | 4 +-- .../markup/snapshots/page-title-v2.snap.html | 2 +- .../panel-page-swnl-title-v2.snap.html | 4 +-- .../panel-question-headers.snap.html | 4 +-- ...question-description-under-input.snap.html | 2 +- .../question-errors-v2-bottom.snap.html | 2 +- .../question-errors-v2-top.snap.html | 2 +- .../snapshots/question-with-indent.snap.html | 2 +- 121 files changed, 211 insertions(+), 128 deletions(-) diff --git a/packages/survey-angular-ui/src/components/dropdown/dropdown.component.html b/packages/survey-angular-ui/src/components/dropdown/dropdown.component.html index c3ac718617..93fc85977b 100644 --- a/packages/survey-angular-ui/src/components/dropdown/dropdown.component.html +++ b/packages/survey-angular-ui/src/components/dropdown/dropdown.component.html @@ -3,7 +3,7 @@ [attr.disabled]="model.isInputReadOnly ? true : null" (blur)="blur($event)" (keydown)="keyhandler($event)" [attr.id]="model.inputId" [attr.aria-required]="model.ariaRequired" [attr.aria-label]="model.ariaLabel" [attr.aria-invalid]="model.ariaInvalid" - [attr.aria-describedby]="model.ariaDescribedBy" [attr.role]="model.ariaRole" + [attr.aria-errormessage]="model.ariaErrormessage" [attr.role]="model.ariaRole" [attr.aria-controls]="dropdownModel.listElementId" [attr.aria-expanded]="model.ariaExpanded" [attr.aria-activedescendant]="dropdownModel.ariaActivedescendant"> @@ -28,6 +28,7 @@ [attr.aria-controls]="dropdownModel.listElementId" [attr.aria-label]="model.a11y_input_ariaLabel" [attr.aria-labelledby]="model.a11y_input_ariaLabelledBy" + [attr.aria-describedby]="model.a11y_input_ariaDescribedBy" [attr.aria-expanded]="model.ariaExpanded" [attr.aria-activedescendant]="dropdownModel.ariaActivedescendant" [attr.placeholder]="dropdownModel.placeholderRendered" diff --git a/packages/survey-angular-ui/src/components/element-header/element-header.component.html b/packages/survey-angular-ui/src/components/element-header/element-header.component.html index cdb9661b25..a087c0e74d 100644 --- a/packages/survey-angular-ui/src/components/element-header/element-header.component.html +++ b/packages/survey-angular-ui/src/components/element-header/element-header.component.html @@ -1,5 +1,5 @@ -
+
\ No newline at end of file diff --git a/packages/survey-angular-ui/src/components/rating/rating-item-smiley.component.html b/packages/survey-angular-ui/src/components/rating/rating-item-smiley.component.html index c0c22741d0..f01ae5ecca 100644 --- a/packages/survey-angular-ui/src/components/rating/rating-item-smiley.component.html +++ b/packages/survey-angular-ui/src/components/rating/rating-item-smiley.component.html @@ -2,7 +2,7 @@