wip bsky client for the web & android
bbell.vt3e.cat
1export const FOCUSABLE_SELECTOR =
2 'a[href], area[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]:not([tabindex="-1"]), [contenteditable]'
3
4export const isNaturallyFocusable = (el: HTMLElement) => {
5 const node = el.nodeName.toLowerCase()
6 if (node === 'a') return (el as HTMLAnchorElement).hasAttribute('href')
7 if (['input', 'select', 'textarea', 'button', 'iframe'].includes(node)) {
8 return !(el as HTMLButtonElement).hasAttribute('disabled')
9 }
10 return false
11}