dom-autofocus
focus an element when it enters the dom
Why?
Because the autofocus
attribute only works on page load.
This module uses a MutationObserver to call .focus()
immediately after the element is mounted.
Install
npm install dom-autofocus
Usage
dom-autofocus
works well with non-virtual DOM diffing libraries like choo:
var autofocus = var html = module { return html` Type here: `}
API
el = autofocus(el)
Autofocus the element when it enters the DOM. Returns the input el
.