This commit is contained in:
Sara Arjona 2024-02-28 16:09:30 +01:00
commit a42d1335f5
No known key found for this signature in database
4 changed files with 26 additions and 8 deletions

View File

@ -260,6 +260,14 @@ CALENDAR.prototype = {
this.toggle_calendar_image();
}
}, this);
// Get the calendarimage element by its ID and check if any of its parents have the modal-dialog class to
// know if the link is inside a modal, if so, set the aria-hidden and tabindex properties to the indicated values.
var calendarimageelement = document.getElementById(this.calendarimage.get('id'));
if (calendarimageelement.closest('.modal-dialog')) {
this.calendarimage.set('aria-hidden', true);
this.calendarimage.set('tabIndex', '-1');
}
},
focus_event: function(e) {
M.form.dateselector.cancel_any_timeout();
@ -363,11 +371,9 @@ CALENDAR.prototype = {
// If the enable checkbox is not checked, disable the calendar image and prevent focus.
if (!this.enablecheckbox.get('checked')) {
this.calendarimage.addClass('disabled');
this.calendarimage.setAttribute('tabindex', -1);
this.release_calendar();
} else {
this.calendarimage.removeClass('disabled');
this.calendarimage.setAttribute('tabindex', 0);
}
}
};

File diff suppressed because one or more lines are too long

View File

@ -260,6 +260,14 @@ CALENDAR.prototype = {
this.toggle_calendar_image();
}
}, this);
// Get the calendarimage element by its ID and check if any of its parents have the modal-dialog class to
// know if the link is inside a modal, if so, set the aria-hidden and tabindex properties to the indicated values.
var calendarimageelement = document.getElementById(this.calendarimage.get('id'));
if (calendarimageelement.closest('.modal-dialog')) {
this.calendarimage.set('aria-hidden', true);
this.calendarimage.set('tabIndex', '-1');
}
},
focus_event: function(e) {
M.form.dateselector.cancel_any_timeout();
@ -363,11 +371,9 @@ CALENDAR.prototype = {
// If the enable checkbox is not checked, disable the calendar image and prevent focus.
if (!this.enablecheckbox.get('checked')) {
this.calendarimage.addClass('disabled');
this.calendarimage.setAttribute('tabindex', -1);
this.release_calendar();
} else {
this.calendarimage.removeClass('disabled');
this.calendarimage.setAttribute('tabindex', 0);
}
}
};

View File

@ -52,6 +52,14 @@ CALENDAR.prototype = {
this.toggle_calendar_image();
}
}, this);
// Get the calendarimage element by its ID and check if any of its parents have the modal-dialog class to
// know if the link is inside a modal, if so, set the aria-hidden and tabindex properties to the indicated values.
var calendarimageelement = document.getElementById(this.calendarimage.get('id'));
if (calendarimageelement.closest('.modal-dialog')) {
this.calendarimage.set('aria-hidden', true);
this.calendarimage.set('tabIndex', '-1');
}
},
focus_event: function(e) {
M.form.dateselector.cancel_any_timeout();
@ -155,11 +163,9 @@ CALENDAR.prototype = {
// If the enable checkbox is not checked, disable the calendar image and prevent focus.
if (!this.enablecheckbox.get('checked')) {
this.calendarimage.addClass('disabled');
this.calendarimage.setAttribute('tabindex', -1);
this.release_calendar();
} else {
this.calendarimage.removeClass('disabled');
this.calendarimage.setAttribute('tabindex', 0);
}
}
};