fix(utils): fix type error (#8779)

This commit is contained in:
zz 2022-07-13 18:48:11 +08:00 committed by GitHub
parent 33fc8e5c4e
commit 50f9a6c7c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,3 @@
// @ts-nocheck
import type { Nullable } from '../typescript'
const FOCUSABLE_ELEMENT_SELECTORS = `a[href],button:not([disabled]),button:not([hidden]),:not([tabindex="-1"]),input:not([disabled]),input:not([type="hidden"]),select:not([disabled]),textarea:not([disabled])`
/**
@ -114,7 +111,7 @@ export const getSibling = (
el: HTMLElement,
distance: number,
elClass: string
): Nullable<Element> => {
) => {
const { parentNode } = el
if (!parentNode) return null
const siblings = parentNode.querySelectorAll(elClass)
@ -122,7 +119,7 @@ export const getSibling = (
return siblings[index + distance] || null
}
export const focusNode = (el) => {
export const focusNode = (el: HTMLElement) => {
if (!el) return
el.focus()
!isLeaf(el) && el.click()