Spotlight.focus error

This commit is contained in:
yonghyon
2024-08-14 00:05:44 +09:00
parent 01140b8d57
commit 9824775259

View File

@@ -66,20 +66,17 @@ const disableConsole = () => {
};
const originFocus = Spotlight.focus;
Spotlight.focus = (elem, containerOption) => {
const ret = originFocus(elem, containerOption);
Spotlight.focus = function (elem, containerOption) {
const ret = originFocus.apply(this, [elem, containerOption]); // this 바인딩을 유지하여 originFocus 호출
if (ret === true) {
const current = Spotlight.getCurrent();
const floatLayerNode = document.getElementById("floatLayer");
//popupShowing
if (floatLayerNode?.childElementCount > 0) {
if (floatLayerNode && floatLayerNode.childElementCount > 0) {
if (!floatLayerNode.contains(current)) {
if (floatLayerNode.lastElementChild) {
const spottableNode = floatLayerNode.lastElementChild.querySelector(
'[data-spotlight-container="true"]'
); //container
const spottableNode = floatLayerNode.lastElementChild.querySelector('[data-spotlight-container="true"]');
if (spottableNode) {
originFocus(spottableNode);
originFocus.apply(this, [spottableNode]); // this 바인딩을 유지하여 originFocus 호출
}
}
}