mirror of
https://github.com/moodle/moodle.git
synced 2025-04-24 18:04:43 +02:00
MDL-79007 calendar: Make screen readers read the new month name
This commit is contained in:
parent
f419983b32
commit
a64446c2ad
calendar
lang/en
2
calendar/amd/build/calendar.min.js
vendored
2
calendar/amd/build/calendar.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -35,6 +35,7 @@ define([
|
||||
'core_calendar/selectors',
|
||||
'core/config',
|
||||
'core/url',
|
||||
'core/str',
|
||||
],
|
||||
function(
|
||||
$,
|
||||
@ -47,6 +48,7 @@ function(
|
||||
CalendarSelectors,
|
||||
Config,
|
||||
Url,
|
||||
Str,
|
||||
) {
|
||||
|
||||
var SELECTORS = {
|
||||
@ -59,7 +61,9 @@ function(
|
||||
CALENDAR_MONTH_WRAPPER: ".calendarwrapper",
|
||||
TODAY: '.today',
|
||||
DAY_NUMBER_CIRCLE: '.day-number-circle',
|
||||
DAY_NUMBER: '.day-number'
|
||||
DAY_NUMBER: '.day-number',
|
||||
SCREEN_READER_ANNOUNCEMENTS: '.calendar-announcements',
|
||||
CURRENT_MONTH: '.calendar-controls .current'
|
||||
};
|
||||
|
||||
/**
|
||||
@ -153,6 +157,12 @@ function(
|
||||
body.on(CalendarEvents.eventMoved, function() {
|
||||
CalendarViewManager.reloadCurrentMonth(root);
|
||||
});
|
||||
// Announce the newly loaded month to screen readers.
|
||||
body.on(CalendarEvents.monthChanged, root, async function() {
|
||||
const monthName = body.find(SELECTORS.CURRENT_MONTH).text();
|
||||
const monthAnnoucement = await Str.get_string('newmonthannouncement', 'calendar', monthName);
|
||||
body.find(SELECTORS.SCREEN_READER_ANNOUNCEMENTS).html(monthAnnoucement);
|
||||
});
|
||||
|
||||
CalendarCrud.registerEditListeners(root, eventFormModalPromise);
|
||||
};
|
||||
|
@ -39,4 +39,5 @@
|
||||
{{{filter_selector}}}
|
||||
{{/filter_selector}}
|
||||
{{> core_calendar/add_event_button}}
|
||||
</div>
|
||||
</div>
|
||||
<div aria-live="polite" class="sr-only calendar-announcements"></div>
|
||||
|
@ -192,6 +192,7 @@ $string['moreevents'] = '{$a} more';
|
||||
$string['namewithsource'] = '{$a->name} ({$a->source})';
|
||||
$string['never'] = 'Never';
|
||||
$string['newevent'] = 'New event';
|
||||
$string['newmonthannouncement'] = 'Calendar is now set to {$a}.';
|
||||
$string['notitle'] = 'no title';
|
||||
$string['noupcomingevents'] = 'There are no upcoming events';
|
||||
$string['nocalendarsubscriptions'] = 'No calendar subscriptions yet. Do you want to {$a}';
|
||||
|
Loading…
x
Reference in New Issue
Block a user