Skip to content

Commit

Permalink
Fixed #7067 - aria-progressbar-name - Ensures every ARIA progressbar …
Browse files Browse the repository at this point in the history
…node has an accessible name (#7068)

Co-authored-by: tsv2013 <tsv2013@noreply.github.com>
  • Loading branch information
tsv2013 and tsv2013 committed Oct 4, 2023
1 parent c2c8fd4 commit 6ecdce2
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ng-template #template>
<div [class]="model.getProgressCssClasses(container)">
<div [class]="model.css.progressBar" [style.width]="model.progressValue + '%'"
role="progressbar" aria-valuemin="0" aria-valuemax="100">
role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-label="progress">
<span [class]="getProgressTextInBarCss(model.css)">
{{ model.progressText }}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
role="progressbar"
aria-valuemin="0"
aria-valuemax="100"
aria-label="progress"
>
<span :class="getProgressTextInBarCss(survey.css)">{{
survey.progressText
Expand Down
2 changes: 1 addition & 1 deletion src/knockout/components/progress/progress.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div data-bind="css: getProgressCssClasses()">
<div data-bind="css: model.css.progressBar, style: { width: model.progressValue + '%' }"
role="progressbar" aria-valuemin="0" aria-valuemax="100">
role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-label="progress">
<span data-bind="text: model.progressText, css: getProgressTextInBarCss(model.css)"></span>
</div>
<span data-bind="text: model.progressText, css: getProgressTextUnderBarCss(model.css)"></span>
Expand Down
1 change: 1 addition & 0 deletions src/react/reactSurveyProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class SurveyProgress extends SurveyNavigationBase {
role="progressbar"
aria-valuemin={0}
aria-valuemax={100}
aria-label="progress"
>
<span
className={SurveyProgressModel.getProgressTextInBarCss(this.css)}
Expand Down
1 change: 1 addition & 0 deletions src/vue/progress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
role="progressbar"
aria-valuemin="0"
aria-valuemax="100"
aria-label="progress"
>
<span :class="getProgressTextInBarCss(survey.css)">{{
survey.progressText
Expand Down
85 changes: 85 additions & 0 deletions testCafe/a11y/navigation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { frameworks, urlV2, initSurvey } from "../helper";
import { fixture, Selector, test } from "testcafe";
import { axeCheck, createReport } from "axe-testcafe";
const title = "navigation";

const json = {
"progressBarType": "pages",
"showProgressBar": "top",
"title": "Customer Satisfaction Survey",
"pages": [{
"navigationTitle": "Overall satisfaction",
"elements": [{
"type": "matrix",
"name": "qualities",
"title": "Please indicate if you agree or disagree with the following statements",
"columns": [{
"value": 5,
"text": "Strongly agree"
}, {
"value": 4,
"text": "Agree"
}, {
"value": 3,
"text": "Neutral"
}, {
"value": 2,
"text": "Disagree"
}, {
"value": 1,
"text": "Strongly disagree"
}],
"rows": [{
"value": "affordable",
"text": "Product is affordable"
}, {
"value": "does-what-it-claims",
"text": "Product does what it claims"
}, {
"value": "better-than-others",
"text": "Product is better than other products on the market"
}, {
"value": "easy-to-use",
"text": "Product is easy to use"
}]
}]
}, {
"navigationTitle": "Pricing",
"elements": [{
"type": "radiogroup",
"name": "price-comparison",
"title": "Compared to our competitors, do you feel our product is:",
"choices": [
"Less expensive",
"Priced about the same",
"More expensive",
"Not sure"
]
}]
}, {
"navigationTitle": "Contacts",
"elements": [{
"type": "text",
"name": "email",
"title": "Please leave your email address if you would like us to contact you."
}]
}],
"showQuestionNumbers": false
};

frameworks.forEach((framework) => {
fixture`${framework} a11y:${title}`.page`${urlV2}${framework}`.beforeEach(
async (t) => {
await initSurvey(framework, json);
}
);

test("progress bar", async (t) => {
await t
.expect(
await Selector("[role='progressbar']").hasAttribute(
"aria-label"
)
).ok();
});
});
1 change: 1 addition & 0 deletions testCafe/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const frameworks = environment
// eslint-disable-next-line no-console
console.log("Frameworks: " + frameworks.join(", "));
export const url = "http://127.0.0.1:8080/examples_test/default/";
export const urlV2 = "http://127.0.0.1:8080/examples_test/defaultV2/";
export const url_test = "http://127.0.0.1:8080/examples_test/";
export const FLOAT_PRECISION = 0.01;

Expand Down

0 comments on commit 6ecdce2

Please sign in to comment.