From 55b270f6b506307cfb735b53ccaf63617b695ab8 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 14 May 2021 12:44:58 +0200 Subject: [PATCH 1/2] MOBILE-3759 a11y: Fix a11y of ion-badges --- scripts/langindex.json | 12 +++++++++ .../myoverview/addon-block-myoverview.html | 7 +++-- .../addon-block-recentlyaccessedcourses.html | 4 ++- .../addon-block-starredcourses.html | 4 ++- .../messages/pages/contacts/contacts.html | 3 ++- .../index/addon-mod-assign-index.html | 26 ++++++++++++++++--- src/addons/mod/assign/lang.json | 5 ++++ .../index/addon-mod-feedback-index.html | 14 ++++++++-- src/addons/mod/feedback/lang.json | 4 ++- .../mod/forum/components/index/index.html | 8 +++--- src/core/classes/tabs.ts | 1 + .../context-menu/context-menu-item.ts | 1 + .../core-context-menu-popover.html | 7 ++++- .../tabs-outlet/core-tabs-outlet.html | 7 ++++- src/core/components/tabs/core-tabs.html | 7 ++++- src/core/components/tabs/tab.ts | 1 + .../components/format/core-course-format.html | 4 ++- src/core/features/course/lang.json | 2 ++ .../features/course/services/course-helper.ts | 6 +++++ src/core/features/courses/lang.json | 1 + .../courses/pages/categories/categories.html | 5 +++- .../courses/pages/my-courses/my-courses.html | 5 +++- .../courses/pages/my-courses/my-courses.ts | 8 ++++++ .../grades/pages/courses/courses.html | 7 ++++- src/core/features/login/lang.json | 3 ++- .../features/login/pages/sites/sites.html | 5 +++- src/core/features/tag/lang.json | 1 + src/core/features/tag/pages/index/index.html | 5 +++- 28 files changed, 138 insertions(+), 25 deletions(-) diff --git a/scripts/langindex.json b/scripts/langindex.json index 4fa085549..543d7f9ac 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -379,10 +379,15 @@ "addon.mod_assign.noteam_desc": "assign", "addon.mod_assign.notgraded": "assign", "addon.mod_assign.numberofdraftsubmissions": "assign", + "addon.mod_assign.numberofdraftsubmissionscountdescription": "local_moodlemobileapp", "addon.mod_assign.numberofparticipants": "assign", + "addon.mod_assign.numberofparticipantscountdescription": "local_moodlemobileapp", "addon.mod_assign.numberofsubmissionsneedgrading": "assign", + "addon.mod_assign.numberofsubmissionsneedgradingcountdescription": "local_moodlemobileapp", "addon.mod_assign.numberofsubmittedassignments": "assign", + "addon.mod_assign.numberofsubmittedassignmentscountdescription": "local_moodlemobileapp", "addon.mod_assign.numberofteams": "assign", + "addon.mod_assign.numberofteamscountdescription": "local_moodlemobileapp", "addon.mod_assign.numwords": "moodle", "addon.mod_assign.outof": "assign", "addon.mod_assign.overdue": "assign", @@ -535,6 +540,7 @@ "addon.mod_feedback.captchaofflinewarning": "local_moodlemobileapp", "addon.mod_feedback.complete_the_form": "feedback", "addon.mod_feedback.completed_feedbacks": "feedback", + "addon.mod_feedback.completedfeedbackscountdescription": "local_moodlemobileapp", "addon.mod_feedback.continue_the_form": "feedback", "addon.mod_feedback.feedback_is_not_open": "feedback", "addon.mod_feedback.feedback_submitted_offline": "local_moodlemobileapp", @@ -557,6 +563,7 @@ "addon.mod_feedback.preview": "moodle", "addon.mod_feedback.previous_page": "feedback", "addon.mod_feedback.questions": "feedback", + "addon.mod_feedback.questionscountdescription": "local_moodlemobileapp", "addon.mod_feedback.response_nr": "feedback", "addon.mod_feedback.responses": "feedback", "addon.mod_feedback.save_entries": "feedback", @@ -1472,6 +1479,8 @@ "core.course.couldnotloadsections": "local_moodlemobileapp", "core.course.coursesummary": "moodle", "core.course.downloadcourse": "tool_mobile", + "core.course.downloadcoursesprogressdescription": "local_moodlemobileapp", + "core.course.downloadsectionprogressdescription": "local_moodlemobileapp", "core.course.errordownloadingcourse": "local_moodlemobileapp", "core.course.errordownloadingsection": "local_moodlemobileapp", "core.course.errorgetmodule": "local_moodlemobileapp", @@ -1531,6 +1540,7 @@ "core.courses.selfenrolment": "local_moodlemobileapp", "core.courses.sendpaymentbutton": "enrol_paypal", "core.courses.show": "block_myoverview", + "core.courses.therearecourses": "moodle", "core.courses.totalcoursesearchresults": "local_moodlemobileapp", "core.currentdevice": "local_moodlemobileapp", "core.datastoredoffline": "local_moodlemobileapp", @@ -1880,6 +1890,7 @@ "core.login.signuprequiredfieldnotsupported": "local_moodlemobileapp", "core.login.siteaddress": "local_moodlemobileapp", "core.login.siteaddressplaceholder": "donottranslate", + "core.login.sitebadgedescription": "local_moodlemobileapp", "core.login.sitehasredirect": "local_moodlemobileapp", "core.login.siteinmaintenance": "local_moodlemobileapp", "core.login.sitepolicynotagreederror": "local_moodlemobileapp", @@ -2169,6 +2180,7 @@ "core.tag.tagarea_course_modules": "tag", "core.tag.tagarea_post": "tag", "core.tag.tagarea_user": "tag", + "core.tag.tagareabadgedescription": "local_moodlemobileapp", "core.tag.tags": "moodle", "core.tag.warningareasnotsupported": "local_moodlemobileapp", "core.teachers": "moodle", diff --git a/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html b/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html index dd8b91778..d1965e2f9 100644 --- a/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html +++ b/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html @@ -10,10 +10,13 @@ - + {{prefetchCoursesData[selectedFilter].badge}} - + - + {{prefetchCoursesData.badge}} diff --git a/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html b/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html index 90064a66d..29b440230 100644 --- a/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html +++ b/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html @@ -7,7 +7,9 @@ (click)="prefetchCourses()" [attr.aria-label]="'core.courses.downloadcourses' | translate"> - + {{prefetchCoursesData.badge}} diff --git a/src/addons/messages/pages/contacts/contacts.html b/src/addons/messages/pages/contacts/contacts.html index 5f478925b..f78025708 100644 --- a/src/addons/messages/pages/contacts/contacts.html +++ b/src/addons/messages/pages/contacts/contacts.html @@ -56,7 +56,8 @@ - + diff --git a/src/addons/mod/assign/components/index/addon-mod-assign-index.html b/src/addons/mod/assign/components/index/addon-mod-assign-index.html index 3a5789600..15a9190fb 100644 --- a/src/addons/mod/assign/components/index/addon-mod-assign-index.html +++ b/src/addons/mod/assign/components/index/addon-mod-assign-index.html @@ -96,7 +96,13 @@

{{ 'addon.mod_assign.numberofparticipants' | translate }}

- {{ summary.participantcount }} + + + {{ 'addon.mod_assign.numberofparticipantscountdescription' | translate:{count: summary.participantcount} }} + + + {{ 'addon.mod_assign.numberofteamscountdescription' | translate:{count: summary.participantcount} }} + @@ -107,7 +113,11 @@ (click)="goToSubmissionList(submissionStatusDraft, !!summary.submissiondraftscount)">

{{ 'addon.mod_assign.numberofdraftsubmissions' | translate }}

- {{ summary.submissiondraftscount }} + + + {{ 'addon.mod_assign.numberofdraftsubmissionscountdescription' | translate: + {count: summary.submissiondraftscount} }} + @@ -118,7 +128,11 @@ (click)="goToSubmissionList(submissionStatusSubmitted, !!summary.submissionssubmittedcount)">

{{ 'addon.mod_assign.numberofsubmittedassignments' | translate }}

- {{ summary.submissionssubmittedcount }} + + + {{ 'addon.mod_assign.numberofsubmittedassignmentscountdescription' | translate: + {count: summary.submissionssubmittedcount} }} + @@ -128,7 +142,11 @@ (click)="goToSubmissionList(needGrading, needsGradingAvailable)">

{{ 'addon.mod_assign.numberofsubmissionsneedgrading' | translate }}

- {{ summary.submissionsneedgradingcount }} + + + {{ 'addon.mod_assign.numberofsubmissionsneedgradingcountdescription' | translate: + {count: summary.submissionsneedgradingcount} }} + diff --git a/src/addons/mod/assign/lang.json b/src/addons/mod/assign/lang.json index 37a598c17..c580f3a80 100644 --- a/src/addons/mod/assign/lang.json +++ b/src/addons/mod/assign/lang.json @@ -64,10 +64,15 @@ "noteam_desc": "This assignment requires submission in groups. You are not a member of any group, so you cannot create a submission. Please contact your teacher to be added to a group.", "notgraded": "Not graded", "numberofdraftsubmissions": "Drafts", + "numberofdraftsubmissionscountdescription": "There are {{count}} drafts.", "numberofparticipants": "Participants", + "numberofparticipantscountdescription": "There are {{count}} participants.", "numberofsubmittedassignments": "Submitted", + "numberofsubmittedassignmentscountdescription": "There are {{count}} submitted assignments.", "numberofsubmissionsneedgrading": "Needs grading", + "numberofsubmissionsneedgradingcountdescription": "There are {{count}} submissions that need grading.", "numberofteams": "Groups", + "numberofteamscountdescription": "There are {{count}} teams.", "numwords": "{{$a}} words", "outof": "{{$a.current}} out of {{$a.total}}", "overdue": "Assignment is overdue by: {{$a}}", diff --git a/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html b/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html index 0a905bc40..ccb014c3f 100644 --- a/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html +++ b/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html @@ -78,7 +78,12 @@

{{ 'addon.mod_feedback.completed_feedbacks' | translate }}

- {{completedCount}} + + + + {{ 'addon.mod_feedback.completedfeedbackscountdescription' | translate:{count: completedCount} }} + + @@ -90,7 +95,12 @@

{{ 'addon.mod_feedback.questions' | translate }}

- {{itemsCount}} + + + + {{ 'addon.mod_feedback.questionscountdescription' | translate:{count: itemsCount} }} + +
diff --git a/src/addons/mod/feedback/lang.json b/src/addons/mod/feedback/lang.json index 5e6381eb3..8d575a97b 100644 --- a/src/addons/mod/feedback/lang.json +++ b/src/addons/mod/feedback/lang.json @@ -6,6 +6,7 @@ "captchaofflinewarning": "Feedback with CAPTCHA cannot be completed offline, or if not configured, or if the server is down.", "complete_the_form": "Answer the questions", "completed_feedbacks": "Submitted answers", + "completedfeedbackscountdescription": "There are {{count}} submitted answers.", "continue_the_form": "Continue answering the questions", "feedback_is_not_open": "The feedback is not open", "feedback_submitted_offline": "This feedback has been saved to be submitted later.", @@ -28,6 +29,7 @@ "preview": "Preview", "previous_page": "Previous page", "questions": "Questions", + "questionscountdescription": "There are {{count}} questions.", "response_nr": "Response number", "responses": "Responses", "save_entries": "Submit your answers", @@ -35,4 +37,4 @@ "show_nonrespondents": "Show non-respondents", "started": "Started", "this_feedback_is_already_submitted": "You've already completed this activity." -} \ No newline at end of file +} diff --git a/src/addons/mod/forum/components/index/index.html b/src/addons/mod/forum/components/index/index.html index e79488e3d..677ba239c 100644 --- a/src/addons/mod/forum/components/index/index.html +++ b/src/addons/mod/forum/components/index/index.html @@ -142,9 +142,11 @@ {{ 'addon.mod_forum.numreplies' | translate:{numreplies: discussion.numreplies} }} - - {{ discussion.numunread }} + + + + {{ 'addon.mod_forum.unreadpostsnumber' | translate:{ '$a' : discussion.numunread} }} + diff --git a/src/core/classes/tabs.ts b/src/core/classes/tabs.ts index 190e754f4..92f76b076 100644 --- a/src/core/classes/tabs.ts +++ b/src/core/classes/tabs.ts @@ -670,5 +670,6 @@ export type CoreTabBase = { icon?: string; // The tab icon. badge?: string; // A badge to add in the tab. badgeStyle?: string; // The badge color. + badgeA11yText?: string; // Accessibility text to add on the badge. enabled?: boolean; // Whether the tab is enabled. }; diff --git a/src/core/components/context-menu/context-menu-item.ts b/src/core/components/context-menu/context-menu-item.ts index 42eee0c8d..10e9da41d 100644 --- a/src/core/components/context-menu/context-menu-item.ts +++ b/src/core/components/context-menu/context-menu-item.ts @@ -50,6 +50,7 @@ export class CoreContextMenuItemComponent implements OnInit, OnDestroy, OnChange @Input() priority?: number; // Used to sort items. The highest priority, the highest position. @Input() badge?: string; // A badge to show in the item. @Input() badgeClass?: number; // A class to set in the badge. + @Input() badgeA11yText?: string; // Description for the badge, if needed. @Input() hidden?: boolean; // Whether the item should be hidden. @Output() action?: EventEmitter<() => void>; // Will emit an event when the item clicked. @Output() onClosed?: EventEmitter<() => void>; // Will emit an event when the popover is closed because the item was clicked. diff --git a/src/core/components/context-menu/core-context-menu-popover.html b/src/core/components/context-menu/core-context-menu-popover.html index 98a46c630..64a3bacf2 100644 --- a/src/core/components/context-menu/core-context-menu-popover.html +++ b/src/core/components/context-menu/core-context-menu-popover.html @@ -12,6 +12,11 @@ [class.icon-slash]="item.iconSlash" slot="end"> - {{item.badge}} + + {{item.badge}} + + {{ item.badgeA11yText | translate: {$a : item.badge } }} + + diff --git a/src/core/components/tabs-outlet/core-tabs-outlet.html b/src/core/components/tabs-outlet/core-tabs-outlet.html index c6963585f..a7d721128 100644 --- a/src/core/components/tabs-outlet/core-tabs-outlet.html +++ b/src/core/components/tabs-outlet/core-tabs-outlet.html @@ -30,7 +30,12 @@ > {{ tab.title | translate}} - {{ tab.badge }} + + {{ tab.badge }} + + {{ tab.badgeA11yText | translate: {$a : tab.badge } }} + + diff --git a/src/core/components/tabs/core-tabs.html b/src/core/components/tabs/core-tabs.html index c15340c3d..940758613 100644 --- a/src/core/components/tabs/core-tabs.html +++ b/src/core/components/tabs/core-tabs.html @@ -28,7 +28,12 @@ > {{ tab.title | translate}} - {{ tab.badge }} + + {{ tab.badge }} + + {{ tab.badgeA11yText | translate: {$a : tab.badge } }} + + diff --git a/src/core/components/tabs/tab.ts b/src/core/components/tabs/tab.ts index dcd9c1f71..8f11dd03e 100644 --- a/src/core/components/tabs/tab.ts +++ b/src/core/components/tabs/tab.ts @@ -49,6 +49,7 @@ export class CoreTabComponent implements OnInit, OnDestroy, CoreTabBase { @Input() icon?: string; // The tab icon. @Input() badge?: string; // A badge to add in the tab. @Input() badgeStyle?: string; // The badge color. + @Input() badgeA11yText?: string; // Accessibility text to add on the badge. @Input() class?: string; // Class, if needed. @Input() set enabled(value: boolean) { // Whether the tab should be shown. value = value === undefined ? true : value; diff --git a/src/core/features/course/components/format/core-course-format.html b/src/core/features/course/components/format/core-course-format.html index 50e81e8e7..9b98dc61d 100644 --- a/src/core/features/course/components/format/core-course-format.html +++ b/src/core/features/course/components/format/core-course-format.html @@ -158,7 +158,9 @@
+ *ngIf="section.isDownloading && section.total > 0 && section.count < section.total" role="progressbar" + aria-valuemin="0" [attr.aria-valuemax]="section.total" [attr.aria-valuenow]="section.count" + [attr.aria-valuetext]="'core.course.downloadsectionprogressdescription' | translate:section"> {{section.count}} / {{section.total}} diff --git a/src/core/features/course/lang.json b/src/core/features/course/lang.json index 54dac5574..835de1253 100644 --- a/src/core/features/course/lang.json +++ b/src/core/features/course/lang.json @@ -30,6 +30,8 @@ "couldnotloadsections": "Could not load the sections. Please try again later.", "coursesummary": "Course summary", "downloadcourse": "Download course", + "downloadcoursesprogressdescription": "Downloading courses: downloaded {{count}} out of {{total}}.", + "downloadsectionprogressdescription": "Downloading section: downloaded {{count}} out of {{total}}.", "errordownloadingcourse": "Error downloading course.", "errordownloadingsection": "Error downloading section.", "errorgetmodule": "Error getting activity data.", diff --git a/src/core/features/course/services/course-helper.ts b/src/core/features/course/services/course-helper.ts index c85ffd0a0..b0f1e8f69 100644 --- a/src/core/features/course/services/course-helper.ts +++ b/src/core/features/course/services/course-helper.ts @@ -135,6 +135,9 @@ export type CorePrefetchStatusInfo = { icon: string; // Icon based on the status. loading: boolean; // If it's a loading status. badge?: string; // Progress badge string if any. + badgeA11yText?: string; // Description of the badge if any. + count?: number; // Amount of already downloaded courses. + total?: number; // Total of courses. downloadSucceeded?: boolean; // Whether download has succeeded (in case it's downloaded). }; @@ -1235,6 +1238,9 @@ export class CoreCourseHelperProvider { try { await this.confirmAndPrefetchCourses(courses, (progress) => { prefetch.badge = progress.count + ' / ' + progress.total; + prefetch.badgeA11yText = Translate.instant('core.course.downloadcoursesprogressdescription', progress); + prefetch.count = progress.count; + prefetch.total = progress.total; }); prefetch.icon = CoreConstants.ICON_OUTDATED; } finally { diff --git a/src/core/features/courses/lang.json b/src/core/features/courses/lang.json index 6323f3023..668442a99 100644 --- a/src/core/features/courses/lang.json +++ b/src/core/features/courses/lang.json @@ -40,5 +40,6 @@ "selfenrolment": "Self enrolment", "sendpaymentbutton": "Send payment via PayPal", "show": "Restore to view", + "therearecourses": "There are {{$a}} courses", "totalcoursesearchresults": "Total courses: {{$a}}" } diff --git a/src/core/features/courses/pages/categories/categories.html b/src/core/features/courses/pages/categories/categories.html index e1216beb6..269573fc2 100644 --- a/src/core/features/courses/pages/categories/categories.html +++ b/src/core/features/courses/pages/categories/categories.html @@ -48,7 +48,10 @@ - {{category.coursecount}} + + + {{ 'core.courses.therearecourses' | translate:{ $a: category.coursecount } }} +
diff --git a/src/core/features/courses/pages/my-courses/my-courses.html b/src/core/features/courses/pages/my-courses/my-courses.html index b0e57f1c8..1fb2aa745 100644 --- a/src/core/features/courses/pages/my-courses/my-courses.html +++ b/src/core/features/courses/pages/my-courses/my-courses.html @@ -20,7 +20,10 @@ [attr.aria-label]="'core.loading' | translate"> {{downloadAllCoursesBadge}} + role="progressbar" aria-valuemin="0" [attr.aria-valuemax]="downloadAllCoursesTotal" + [attr.aria-valuenow]="downloadAllCoursesCount" [attr.aria-valuetext]="downloadAllCoursesBadgeA11yText"> + {{downloadAllCoursesBadge}} +
diff --git a/src/core/features/courses/pages/my-courses/my-courses.ts b/src/core/features/courses/pages/my-courses/my-courses.ts index eb5f2d0b8..967e51484 100644 --- a/src/core/features/courses/pages/my-courses/my-courses.ts +++ b/src/core/features/courses/pages/my-courses/my-courses.ts @@ -26,6 +26,7 @@ import { CoreCourseHelper } from '@features/course/services/course-helper'; import { CoreConstants } from '@/core/constants'; import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate'; import { CoreNavigator } from '@services/navigator'; +import { Translate } from '@singletons'; /** * Page that displays the list of courses the user is enrolled in. @@ -48,6 +49,9 @@ export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy { downloadAllCoursesLoading = false; downloadAllCoursesBadge = ''; downloadAllCoursesEnabled = false; + downloadAllCoursesCount?: number; + downloadAllCoursesTotal?: number; + downloadAllCoursesBadgeA11yText = ''; protected myCoursesObserver: CoreEventObserver; protected siteUpdatedObserver: CoreEventObserver; @@ -183,6 +187,10 @@ export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy { try { await CoreCourseHelper.confirmAndPrefetchCourses(this.courses, (progress) => { this.downloadAllCoursesBadge = progress.count + ' / ' + progress.total; + this.downloadAllCoursesBadgeA11yText = + Translate.instant('core.course.downloadcoursesprogressdescription', progress); + this.downloadAllCoursesCount = progress.count; + this.downloadAllCoursesTotal = progress.total; }); } catch (error) { if (!this.isDestroyed) { diff --git a/src/core/features/grades/pages/courses/courses.html b/src/core/features/grades/pages/courses/courses.html index 8ebd5f052..4a4ef30bf 100644 --- a/src/core/features/grades/pages/courses/courses.html +++ b/src/core/features/grades/pages/courses/courses.html @@ -35,7 +35,12 @@ contextLevel="course" > - {{course.grade}} + + + {{ 'core.grades.grade' | translate }} + + {{course.grade}} + diff --git a/src/core/features/login/lang.json b/src/core/features/login/lang.json index 29cf529c3..ecf4be149 100644 --- a/src/core/features/login/lang.json +++ b/src/core/features/login/lang.json @@ -105,6 +105,7 @@ "signuprequiredfieldnotsupported": "The signup form contains a required custom field that isn't supported in the app. Please create your account using a web browser.", "siteaddress": "Your site", "siteaddressplaceholder": "https://campus.example.edu", + "sitebadgedescription": "There are {{count}} unread notifications.", "sitehasredirect": "Your site contains at least one HTTP redirect. The app cannot follow redirects, this could be the issue that's preventing the app from connecting to your site.", "siteinmaintenance": "Your site is in maintenance mode", "sitepolicynotagreederror": "Site policy not agreed.", @@ -121,4 +122,4 @@ "webservicesnotenabled": "Your host site may not have enabled Web services. Please contact your administrator for help.", "youcanstillconnectwithcredentials": "You can still connect to the site by entering your username and password.", "yourenteredsite": "Connect to your site" -} \ No newline at end of file +} diff --git a/src/core/features/login/pages/sites/sites.html b/src/core/features/login/pages/sites/sites.html index e9c437993..c7a7bdaf2 100644 --- a/src/core/features/login/pages/sites/sites.html +++ b/src/core/features/login/pages/sites/sites.html @@ -29,7 +29,10 @@

{{site.siteUrl}}

- {{site.badge}} + + + {{ 'core.login.sitebadgedescription' | translate:{ count: site.badge } }} + diff --git a/src/core/features/tag/lang.json b/src/core/features/tag/lang.json index b94bad4fd..bf320e3f6 100644 --- a/src/core/features/tag/lang.json +++ b/src/core/features/tag/lang.json @@ -8,6 +8,7 @@ "searchtags": "Search tags", "showingfirsttags": "Showing {{$a}} most popular tags", "tag": "Tag", + "tagareabadgedescription": "There are {{count}} items.", "tagarea_course": "Courses", "tagarea_course_modules": "Activities and resources", "tagarea_post": "Blog posts", diff --git a/src/core/features/tag/pages/index/index.html b/src/core/features/tag/pages/index/index.html index fb6fbed96..da105551b 100644 --- a/src/core/features/tag/pages/index/index.html +++ b/src/core/features/tag/pages/index/index.html @@ -23,7 +23,10 @@

{{ area!.nameKey | translate }}

- {{ area!.badge }} + + + {{ 'core.tag.tagareabadgedescription' | translate:{ count: area!.badge } }} + Date: Fri, 14 May 2021 15:56:17 +0200 Subject: [PATCH 2/2] MOBILE-3759 a11y: Fix a11y of progress bars --- scripts/langindex.json | 1 + .../myoverview/addon-block-myoverview.html | 2 +- .../addon-block-recentlyaccessedcourses.html | 2 +- .../addon-block-starredcourses.html | 2 +- .../coursecompetencies/coursecompetencies.html | 10 +++++++--- src/addons/competency/pages/plan/plan.html | 6 ++++-- .../index/addon-mod-h5pactivity-index.html | 2 +- .../components/index/addon-mod-lesson-index.html | 3 ++- src/addons/mod/lesson/pages/player/player.html | 15 +++++++++++---- src/addons/mod/lesson/pages/player/player.page.ts | 2 +- .../mod/lesson/pages/user-retake/user-retake.html | 2 +- .../components/index/addon-mod-scorm-index.html | 3 ++- .../progress-bar/core-progress-bar.html | 8 ++++++-- src/core/components/progress-bar/progress-bar.ts | 11 +++++++++++ .../components/format/core-course-format.html | 5 +++-- .../features/course/components/format/format.ts | 9 +++------ .../section-selector/section-selector.html | 4 +++- src/core/features/course/lang.json | 1 + .../core-courses-course-list-item.html | 2 +- .../core-courses-course-progress.html | 2 +- .../courses/pages/my-courses/my-courses.html | 2 +- 21 files changed, 63 insertions(+), 31 deletions(-) diff --git a/scripts/langindex.json b/scripts/langindex.json index 543d7f9ac..28c9b6d7f 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -1452,6 +1452,7 @@ "core.course.activitynotyetviewableremoteaddon": "local_moodlemobileapp", "core.course.activitynotyetviewablesiteupgradeneeded": "local_moodlemobileapp", "core.course.allsections": "local_moodlemobileapp", + "core.course.aria:sectionprogress": "local_moodlemobileapp", "core.course.askadmintosupport": "local_moodlemobileapp", "core.course.availablespace": "local_moodlemobileapp", "core.course.cannotdeletewhiledownloading": "local_moodlemobileapp", diff --git a/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html b/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html index d1965e2f9..c5b90ffd9 100644 --- a/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html +++ b/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html @@ -11,7 +11,7 @@
{{prefetchCoursesData[selectedFilter].badge}} diff --git a/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html b/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html index 9939071b8..0f445b464 100644 --- a/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html +++ b/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html @@ -8,7 +8,7 @@ {{prefetchCoursesData.badge}} diff --git a/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html b/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html index 29b440230..dec6f7412 100644 --- a/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html +++ b/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html @@ -8,7 +8,7 @@ {{prefetchCoursesData.badge}} diff --git a/src/addons/competency/pages/coursecompetencies/coursecompetencies.html b/src/addons/competency/pages/coursecompetencies/coursecompetencies.html index 03d920cf6..091bd1676 100644 --- a/src/addons/competency/pages/coursecompetencies/coursecompetencies.html +++ b/src/addons/competency/pages/coursecompetencies/coursecompetencies.html @@ -22,9 +22,13 @@ - {{ 'addon.competency.xcompetenciesproficientoutofyincourse' | translate: {$a: - {x: competencies.statistics.proficientcompetencycount, y: competencies.statistics.competencycount} } }} - + + {{ 'addon.competency.xcompetenciesproficientoutofyincourse' | translate: {$a: + {x: competencies.statistics.proficientcompetencycount, y: competencies.statistics.competencycount} } }} + + + -

+

{{ 'addon.competency.progress' | translate }}: {{ 'addon.competency.xcompetenciesproficientoutofy' | translate: {$a: {x: plan.proficientcompetencycount, y: plan.competencycount} } }}

+ [text]="plan.proficientcompetencypercentageformatted" + ariaDescribedBy="addon-competency-plan-{{plan.plan.id}}-progress"> +
diff --git a/src/addons/mod/h5pactivity/components/index/addon-mod-h5pactivity-index.html b/src/addons/mod/h5pactivity/components/index/addon-mod-h5pactivity-index.html index 86dbd3f42..55c0b2c4b 100644 --- a/src/addons/mod/h5pactivity/components/index/addon-mod-h5pactivity-index.html +++ b/src/addons/mod/h5pactivity/components/index/addon-mod-h5pactivity-index.html @@ -85,7 +85,7 @@

{{ progressMessage | translate }}

- +
diff --git a/src/addons/mod/lesson/components/index/addon-mod-lesson-index.html b/src/addons/mod/lesson/components/index/addon-mod-lesson-index.html index b9f84e270..21180d618 100644 --- a/src/addons/mod/lesson/components/index/addon-mod-lesson-index.html +++ b/src/addons/mod/lesson/components/index/addon-mod-lesson-index.html @@ -301,7 +301,8 @@

{{ student.fullname }}

- + +
diff --git a/src/addons/mod/lesson/pages/player/player.html b/src/addons/mod/lesson/pages/player/player.html index 21f3668dc..bdf332aef 100644 --- a/src/addons/mod/lesson/pages/player/player.html +++ b/src/addons/mod/lesson/pages/player/player.html @@ -170,8 +170,11 @@ - {{ 'addon.mod_lesson.progresscompleted' | translate:{$a: pageData.progress} }} - + + {{ 'addon.mod_lesson.progresscompleted' | translate:{$a: pageData.progress} }} + + +
@@ -224,8 +227,12 @@ - {{ 'addon.mod_lesson.progresscompleted' | translate:{$a: eolData.progresscompleted.value} }} - + + {{ 'addon.mod_lesson.progresscompleted' | translate:{$a: eolData.progresscompleted.value} }} + + + diff --git a/src/addons/mod/lesson/pages/player/player.page.ts b/src/addons/mod/lesson/pages/player/player.page.ts index 0f3d01787..1a014068c 100644 --- a/src/addons/mod/lesson/pages/player/player.page.ts +++ b/src/addons/mod/lesson/pages/player/player.page.ts @@ -98,8 +98,8 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { loadingMenu?: boolean; // Whether the lesson menu is being loaded. mediaFile?: CoreWSExternalFile; // Media file of the lesson. activityLink?: AddonModLessonActivityLink; // Next activity link data. + cmId!: number; // Course module ID. - protected cmId!: number; // Course module ID. protected password?: string; // Lesson password (if any). protected forceLeave = false; // If true, don't perform any check when leaving the view. protected offline?: boolean; // Whether we are in offline mode. diff --git a/src/addons/mod/lesson/pages/user-retake/user-retake.html b/src/addons/mod/lesson/pages/user-retake/user-retake.html index 77900e473..0684f5507 100644 --- a/src/addons/mod/lesson/pages/user-retake/user-retake.html +++ b/src/addons/mod/lesson/pages/user-retake/user-retake.html @@ -19,7 +19,7 @@

{{student.fullname}}

- +
diff --git a/src/addons/mod/scorm/components/index/addon-mod-scorm-index.html b/src/addons/mod/scorm/components/index/addon-mod-scorm-index.html index 60c6f6f9a..b5d76b0f0 100644 --- a/src/addons/mod/scorm/components/index/addon-mod-scorm-index.html +++ b/src/addons/mod/scorm/components/index/addon-mod-scorm-index.html @@ -242,7 +242,8 @@

{{ progressMessage | translate }}

- + +
diff --git a/src/core/components/progress-bar/core-progress-bar.html b/src/core/components/progress-bar/core-progress-bar.html index 7583839a4..90f75d9df 100644 --- a/src/core/components/progress-bar/core-progress-bar.html +++ b/src/core/components/progress-bar/core-progress-bar.html @@ -1,5 +1,9 @@ - + -
{{ 'core.percentagenumber' | translate: {$a: text} }}
+
+ {{ a11yText | translate }} + {{ 'core.percentagenumber' | translate: {$a: text} }} +
diff --git a/src/core/components/progress-bar/progress-bar.ts b/src/core/components/progress-bar/progress-bar.ts index 39267d2f0..615aef875 100644 --- a/src/core/components/progress-bar/progress-bar.ts +++ b/src/core/components/progress-bar/progress-bar.ts @@ -14,6 +14,7 @@ import { Component, Input, OnChanges, SimpleChange, ChangeDetectionStrategy } from '@angular/core'; import { DomSanitizer, SafeStyle } from '@angular/platform-browser'; +import { Translate } from '@singletons'; /** * Component to show a progress bar and its value. @@ -31,7 +32,12 @@ export class CoreProgressBarComponent implements OnChanges { @Input() progress!: number | string; // Percentage from 0 to 100. @Input() text?: string; // Percentage in text to be shown at the right. If not defined, progress will be used. + @Input() a11yText?: string; // Accessibility text to read before the percentage. + @Input() ariaDescribedBy?: string; // ID of the element that described the progress, if any. + width?: SafeStyle; + progressBarValueText?: string; + protected textSupplied = false; constructor(private sanitizer: DomSanitizer) { } @@ -66,6 +72,11 @@ export class CoreProgressBarComponent implements OnChanges { this.width = this.sanitizer.bypassSecurityTrustStyle(this.progress + '%'); } } + + if (changes.text || changes.progress || changes.a11yText) { + this.progressBarValueText = (this.a11yText ? Translate.instant(this.a11yText) + ' ' : '') + + Translate.instant('core.percentagenumber', { $a: this.text }); + } } } diff --git a/src/core/features/course/components/format/core-course-format.html b/src/core/features/course/components/format/core-course-format.html index 9b98dc61d..223fe9458 100644 --- a/src/core/features/course/components/format/core-course-format.html +++ b/src/core/features/course/components/format/core-course-format.html @@ -45,7 +45,8 @@ - + + @@ -159,7 +160,7 @@ {{section.count}} / {{section.total}} diff --git a/src/core/features/course/components/format/format.ts b/src/core/features/course/components/format/format.ts index 4f14cd84b..b756f4ae0 100644 --- a/src/core/features/course/components/format/format.ts +++ b/src/core/features/course/components/format/format.ts @@ -105,6 +105,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { progress?: number; sectionSelectorModalOptions: ModalOptions = { component: CoreCourseSectionSelectorComponent, + componentProps: {}, }; protected sectionStatusObserver?: CoreEventObserver; @@ -124,12 +125,6 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { * Component being initialized. */ ngOnInit(): void { - - this.sectionSelectorModalOptions.componentProps = { - course: this.course, - sections: this.sections, - }; - // Listen for section status changes. this.sectionStatusObserver = CoreEvents.on( CoreEvents.SECTION_STATUS_CHANGED, @@ -187,6 +182,8 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { */ ngOnChanges(changes: { [name: string]: SimpleChange }): void { this.setInputData(); + this.sectionSelectorModalOptions.componentProps!.course = this.course; + this.sectionSelectorModalOptions.componentProps!.sections = this.sections; if (changes.course && this.course) { // Course has changed, try to get the components. diff --git a/src/core/features/course/components/section-selector/section-selector.html b/src/core/features/course/components/section-selector/section-selector.html index 238e1ce58..8d7a051ee 100644 --- a/src/core/features/course/components/section-selector/section-selector.html +++ b/src/core/features/course/components/section-selector/section-selector.html @@ -20,7 +20,9 @@

- + + diff --git a/src/core/features/course/lang.json b/src/core/features/course/lang.json index 835de1253..f383e9d84 100644 --- a/src/core/features/course/lang.json +++ b/src/core/features/course/lang.json @@ -3,6 +3,7 @@ "activitynotyetviewableremoteaddon": "Your organisation installed a plugin that is not yet supported.", "activitynotyetviewablesiteupgradeneeded": "Your organisation's Moodle installation needs to be updated.", "allsections": "All sections", + "aria:sectionprogress": "Section progress:", "askadmintosupport": "Contact the site administrator and tell them you want to use this activity with the Moodle Mobile app.", "availablespace": " You currently have about {{available}} free space.", "cannotdeletewhiledownloading": "Files cannot be deleted while the activity is being downloaded. Please wait for the download to finish.", diff --git a/src/core/features/courses/components/course-list-item/core-courses-course-list-item.html b/src/core/features/courses/components/course-list-item/core-courses-course-list-item.html index 83aa9653e..16b4872d8 100644 --- a/src/core/features/courses/components/course-list-item/core-courses-course-list-item.html +++ b/src/core/features/courses/components/course-list-item/core-courses-course-list-item.html @@ -24,7 +24,7 @@

- +

diff --git a/src/core/features/courses/components/course-progress/core-courses-course-progress.html b/src/core/features/courses/components/course-progress/core-courses-course-progress.html index 5599247be..02f3d39e6 100644 --- a/src/core/features/courses/components/course-progress/core-courses-course-progress.html +++ b/src/core/features/courses/components/course-progress/core-courses-course-progress.html @@ -56,7 +56,7 @@
- + diff --git a/src/core/features/courses/pages/my-courses/my-courses.html b/src/core/features/courses/pages/my-courses/my-courses.html index 1fb2aa745..6e7d6f8a6 100644 --- a/src/core/features/courses/pages/my-courses/my-courses.html +++ b/src/core/features/courses/pages/my-courses/my-courses.html @@ -20,7 +20,7 @@ [attr.aria-label]="'core.loading' | translate"> {{downloadAllCoursesBadge}}