fix some errors in typescript

This commit is contained in:
Matteo Manzinello
2020-07-24 10:40:46 +02:00
parent 749ebdd628
commit 4237137107
7 changed files with 48 additions and 39 deletions

View File

@@ -977,18 +977,18 @@ var setModalDisplay = function setModalDisplay() {
var modal = getModalHTMLElement(ref);
modal.style.display = value;
if (value === 'flex') {
if (value === "flex") {
// "save" the activated link.
activatedLink = document.activeElement;
modal.setAttribute('aria-hidden', false); // Focus on the modal container.
modal.setAttribute("aria-hidden", "false"); // Focus on the modal container.
modal.setAttribute('tabindex', "0");
modal.setAttribute("tabindex", "0");
modal.focus();
setFocusLoop(modal);
} else {
modal.setAttribute('aria-hidden', true); // focus back the activated link for getting back to the context.
modal.setAttribute("aria-hidden", "true"); // focus back the activated link for getting back to the context.
modal.setAttribute('tabindex', '-1');
modal.setAttribute("tabindex", "-1");
activatedLink.focus();
}
}; // set focus loop within modal
@@ -996,23 +996,23 @@ var setModalDisplay = function setModalDisplay() {
var setFocusLoop = function setFocusLoop(ref) {
var modal = ref;
modal.querySelector('.m-modal-content a:last-of-type').addEventListener('keydown', leaveLastLink);
modal.querySelector('.m-modal-content a:first-of-type').addEventListener('keydown', leaveFirstLink);
modal.querySelector(".m-modal-content a:last-of-type").addEventListener("keydown", leaveLastLink);
modal.querySelector(".m-modal-content a:first-of-type").addEventListener("keydown", leaveFirstLink);
};
var leaveLastLink = function leaveLastLink(e) {
// going back to the first link to force looping
if (e.code === 'Tab' && e.shiftKey === false) {
if (e.code === "Tab" && e.shiftKey === false) {
e.preventDefault();
e.target.closest('div').querySelector('a:first-of-type').focus();
e.target.closest("div").querySelector("a:first-of-type").focus();
}
};
var leaveFirstLink = function leaveFirstLink(e) {
// going back to the first link to force looping
if (e.code === 'Tab' && e.shiftKey === true) {
if (e.code === "Tab" && e.shiftKey === true) {
e.preventDefault();
e.target.closest('div').querySelector('a:last-of-type').focus();
e.target.closest("div").querySelector("a:last-of-type").focus();
}
}; // enable dark mode

File diff suppressed because one or more lines are too long