lint fixes

This commit is contained in:
syuilo
2025-03-20 19:00:09 +09:00
parent c02f0b3b33
commit 6015254e59
71 changed files with 160 additions and 160 deletions

View File

@@ -358,10 +358,10 @@ function switchItem(item: MenuSwitch & { ref: any }) {
function focusUp() {
if (disposed) return;
if (!itemsEl.value?.contains(document.activeElement)) return;
if (!itemsEl.value?.contains(window.document.activeElement)) return;
const focusableElements = Array.from(itemsEl.value.children).filter(isFocusable);
const activeIndex = focusableElements.findIndex(el => el === document.activeElement);
const activeIndex = focusableElements.findIndex(el => el === window.document.activeElement);
const targetIndex = (activeIndex !== -1 && activeIndex !== 0) ? (activeIndex - 1) : (focusableElements.length - 1);
const targetElement = focusableElements.at(targetIndex) ?? itemsEl.value;
@@ -370,10 +370,10 @@ function focusUp() {
function focusDown() {
if (disposed) return;
if (!itemsEl.value?.contains(document.activeElement)) return;
if (!itemsEl.value?.contains(window.document.activeElement)) return;
const focusableElements = Array.from(itemsEl.value.children).filter(isFocusable);
const activeIndex = focusableElements.findIndex(el => el === document.activeElement);
const activeIndex = focusableElements.findIndex(el => el === window.document.activeElement);
const targetIndex = (activeIndex !== -1 && activeIndex !== (focusableElements.length - 1)) ? (activeIndex + 1) : 0;
const targetElement = focusableElements.at(targetIndex) ?? itemsEl.value;
@@ -400,9 +400,9 @@ const onGlobalMousedown = (ev: MouseEvent) => {
const setupHandlers = () => {
if (!isNestingMenu) {
document.addEventListener('focusin', onGlobalFocusin, { passive: true });
window.document.addEventListener('focusin', onGlobalFocusin, { passive: true });
}
document.addEventListener('mousedown', onGlobalMousedown, { passive: true });
window.document.addEventListener('mousedown', onGlobalMousedown, { passive: true });
};
let disposed = false;
@@ -410,9 +410,9 @@ let disposed = false;
const disposeHandlers = () => {
disposed = true;
if (!isNestingMenu) {
document.removeEventListener('focusin', onGlobalFocusin);
window.document.removeEventListener('focusin', onGlobalFocusin);
}
document.removeEventListener('mousedown', onGlobalMousedown);
window.document.removeEventListener('mousedown', onGlobalMousedown);
};
onMounted(() => {