Skip to content

Commit

Permalink
Accessibility calendar switch buttons (#11661)
Browse files Browse the repository at this point in the history
* Aria labels for calendar navigation

* Included trans func

* First letter capital to follow other text examples
  • Loading branch information
littlesvensson authored Feb 6, 2025
1 parent 45d9dfe commit 2e1042b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
20 changes: 20 additions & 0 deletions dojo/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -4964,3 +4964,23 @@ msgstr ""
#: dojo/utils.py
msgid "Home"
msgstr ""

#: dojo/templates/dojo/calendar.html
msgid "Previous month"
msgstr ""

#: dojo/templates/dojo/calendar.html
msgid "Next month"
msgstr ""

#: dojo/templates/dojo/calendar.html
msgid "Month preview"
msgstr ""

#: dojo/templates/dojo/calendar.html
msgid "Week preview"
msgstr ""

#: dojo/templates/dojo/calendar.html
msgid "Day preview"
msgstr ""
11 changes: 10 additions & 1 deletion dojo/templates/dojo/calendar.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% extends 'base.html' %}
{% load static %}
{% load i18n %}

{% block content %}
{{ block.super }}
Expand Down Expand Up @@ -75,7 +76,15 @@
},
{% endfor %}
{% endif %}
]
],
viewRender: function(view, element) {
// Updating aria-label attributes calendar switches after the view is rendered
$('.fc-prev-button').attr('aria-label', '{% trans "Previous month" %}');
$('.fc-next-button').attr('aria-label', '{% trans "Next month" %}');
$('.fc-month-button').attr('aria-label', '{% trans "Month preview" %}');
$('.fc-basicWeek-button').attr('aria-label', '{% trans "Week preview" %}');
$('.fc-basicDay-button').attr('aria-label', '{% trans "Day preview" %}');
}
});
});
</script>
Expand Down

0 comments on commit 2e1042b

Please sign in to comment.