This is the function, from umbraco.directives.js that’s throwing errors:
function setElementFocus() {
var lastKnownElement, defaultFocusedElement = function getAutoFocusElement(elements) {
var elmentWithAutoFocus = null;
return elements.forEach(element => {
"true" === element.getAttribute("umb-auto-focus") && (elmentWithAutoFocus = element)
}
),
elmentWithAutoFocus
}(focusableElements);
if (closingEditor) {
if (infiniteEditors && 1 === infiniteEditors.length) {
var editorInfo = infiniteEditors[0].querySelector(".editor-info");
infiniteEditors && 1 === infiniteEditors.length && null !== editorInfo && (lastKnownElement = editorInfo,
clearLastKnownFocusedElements())
} else {
var lastItemIndex = $rootScope.lastKnownFocusableElements.length - 1;
lastKnownElement = $rootScope.lastKnownFocusableElements[lastItemIndex],
$rootScope.lastKnownFocusableElements.splice(lastItemIndex, 1)
}
closingEditor = !1
}
lastKnownElement ? lastKnownElement.focus() : null === defaultFocusedElement ? 0 === focusableElements.findIndex(elm => elm.classList.contains("umb-button-ellipsis") || elm.classList.contains("umb-sub-views-nav-item__action") || elm.classList.contains("umb-tab-button") && !elm.parent.classList.contains("umb-tab")) ? focusableElements[1].focus() : firstFocusableElement.focus() : defaultFocusedElement.focus()
}(),
target.addEventListener("keydown", handleKeydown))
}
, 500)
the lastKnownElement variable is undefined, which causes the issue i’ve no idea how to fix this though