/browser-element-focus

Tool for play with the focus of browser elements

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Tree

Social Media Photo by Andrew Ridley on Unsplash

Browser Element Focus

Formato de exportación: UMD, CJS, ESM Distribución: Npm, Unpackage Licencia: GPL 3.0

Uso

Esta es una librería con utilidades para gestionar el foco de los elementos en el navegador.

Npm

npm install --save browser-element-focus

Unpkg

import {findFocusableElement} from 'https://unpkg.com/browser-element-focus?module'

API

  • getFocusableWalker()
  • findFocusableElement()
  • isFocusable()

# getFocusableWalker()

Sintaxis

getFocusableWalker(rootElement);

Parámentros

  • rootElement: Nodo raiz, que hereda de HTMLElement, en el que se iniciará la búsqueda.

Valor devuelto

Devuelve un objeto TreeWalker

# findFocusableElement()

Sintaxis

findFocusableElement(rootElement);

Parámentros

  • rootElement: Nodo raiz, que hereda de HTMLElement, en el que se iniciará la búsqueda.

Valor devuelto

Devuelve el primer nodo encontrado, que pueda obtener el foco, o undefined en caso de no encontrar ninguno.

# isFocusable()

Sintaxis

isFocusable(nodeElement);

Parámentros

  • nodeElement: Nodo que hereda de HTMLElement

Valor devuelto

Verdadero/Falso en función de si el elemento es o no un elemento que puede obtener el foco

Enlaces de Interes