This commit is contained in:
Sara Arjona
2024-04-11 11:03:21 +02:00
4 changed files with 35 additions and 2 deletions
@@ -316,6 +316,17 @@ CALENDAR.prototype = {
// When the user tab out the calendar, close it.
Y.one(document.body).on('keyup', function(e) {
// If the calendar is open and we try to access it by pressing tab, we check if it is inside a Bootstrap dropdown-menu,
// if so, we keep the dropdown open while navigation takes place in the calendar.
if (M.form.dateselector.currentowner && e.keyCode === 9) {
e.stopPropagation();
var calendarimageelement = document.getElementById(M.form.dateselector.currentowner.calendarimage.get('id'));
if (M.form.dateselector.calendar.get('focused') && calendarimageelement.closest('.dropdown-menu') &&
!calendarimageelement.closest('.dropdown-menu').classList.contains("show")) {
calendarimageelement.closest('.dropdown-menu').classList.add('show');
}
}
// hide the calendar if we press a key and the calendar is not focussed, or if we press ESC in the calendar.
if ((M.form.dateselector.currentowner === this && !M.form.dateselector.calendar.get('focused')) ||
((e.keyCode === 27) && M.form.dateselector.calendar.get('focused'))) {
File diff suppressed because one or more lines are too long
@@ -316,6 +316,17 @@ CALENDAR.prototype = {
// When the user tab out the calendar, close it.
Y.one(document.body).on('keyup', function(e) {
// If the calendar is open and we try to access it by pressing tab, we check if it is inside a Bootstrap dropdown-menu,
// if so, we keep the dropdown open while navigation takes place in the calendar.
if (M.form.dateselector.currentowner && e.keyCode === 9) {
e.stopPropagation();
var calendarimageelement = document.getElementById(M.form.dateselector.currentowner.calendarimage.get('id'));
if (M.form.dateselector.calendar.get('focused') && calendarimageelement.closest('.dropdown-menu') &&
!calendarimageelement.closest('.dropdown-menu').classList.contains("show")) {
calendarimageelement.closest('.dropdown-menu').classList.add('show');
}
}
// hide the calendar if we press a key and the calendar is not focussed, or if we press ESC in the calendar.
if ((M.form.dateselector.currentowner === this && !M.form.dateselector.calendar.get('focused')) ||
((e.keyCode === 27) && M.form.dateselector.calendar.get('focused'))) {
+11
View File
@@ -108,6 +108,17 @@ CALENDAR.prototype = {
// When the user tab out the calendar, close it.
Y.one(document.body).on('keyup', function(e) {
// If the calendar is open and we try to access it by pressing tab, we check if it is inside a Bootstrap dropdown-menu,
// if so, we keep the dropdown open while navigation takes place in the calendar.
if (M.form.dateselector.currentowner && e.keyCode === 9) {
e.stopPropagation();
var calendarimageelement = document.getElementById(M.form.dateselector.currentowner.calendarimage.get('id'));
if (M.form.dateselector.calendar.get('focused') && calendarimageelement.closest('.dropdown-menu') &&
!calendarimageelement.closest('.dropdown-menu').classList.contains("show")) {
calendarimageelement.closest('.dropdown-menu').classList.add('show');
}
}
// hide the calendar if we press a key and the calendar is not focussed, or if we press ESC in the calendar.
if ((M.form.dateselector.currentowner === this && !M.form.dateselector.calendar.get('focused')) ||
((e.keyCode === 27) && M.form.dateselector.calendar.get('focused'))) {