MCPcopy Create free account
hub / github.com/DHTMLX/scheduler / modals

Function modals

codebase/sources/dhtmlxscheduler.js:12249–12346  ·  view source on GitHub ↗
(scheduler2)

Source from the content-addressed store, hash-verified

12247 scheduler2.$keyboardNavigation.DataArea.prototype.bindAll(scheduler2.$keyboardNavigation.DataArea.prototype.keys);
12248 }
12249 function modals(scheduler2) {
12250 (function() {
12251 var modalsStack = [];
12252 function isModal() {
12253 return !!modalsStack.length;
12254 }
12255 function isChildOf(child, parent) {
12256 while (child && child != parent) {
12257 child = child.parentNode;
12258 }
12259 return !!(child == parent);
12260 }
12261 function afterPopup(box) {
12262 setTimeout(function() {
12263 if (scheduler2.$destroyed) {
12264 return true;
12265 }
12266 if (!isModal() && !isChildOf(document.activeElement, scheduler2.$container)) {
12267 scheduler2.focus();
12268 }
12269 }, 1);
12270 }
12271 function startModal(box) {
12272 scheduler2.eventRemove(box, "keydown", trapFocus);
12273 scheduler2.event(box, "keydown", trapFocus);
12274 modalsStack.push(box);
12275 }
12276 function endModal() {
12277 var box = modalsStack.pop();
12278 if (box) {
12279 scheduler2.eventRemove(box, "keydown", trapFocus);
12280 }
12281 afterPopup();
12282 }
12283 function isTopModal(box) {
12284 return box == modalsStack[modalsStack.length - 1];
12285 }
12286 function trapFocus(event2) {
12287 var event2 = event2 || window.event;
12288 var target = event2.currentTarget;
12289 if (!isTopModal(target))
12290 return;
12291 scheduler2.$keyboardNavigation.trapFocus(target, event2);
12292 }
12293 function traceLightbox() {
12294 startModal(scheduler2.getLightbox());
12295 }
12296 scheduler2.attachEvent("onLightbox", traceLightbox);
12297 scheduler2.attachEvent("onAfterLightbox", endModal);
12298 scheduler2.attachEvent("onAfterQuickInfo", function() {
12299 afterPopup();
12300 });
12301 if (!scheduler2._keyNavMessagePopup) {
12302 scheduler2._keyNavMessagePopup = true;
12303 var focusElement = null;
12304 var backupFocus = null;
12305 const modalsStack2 = [];
12306 scheduler2.attachEvent("onMessagePopup", function(box) {

Callers 1

key_navFunction · 0.70

Calls 5

afterPopupFunction · 0.70
attachEventMethod · 0.65
eventRemoveMethod · 0.65
eventMethod · 0.65
focusMethod · 0.65

Tested by

no test coverage detected