find-focused-element package is available22 Apr 2020
It’s a short post about a new npm package I’ve just uploaded.
While developing a chrome extension I needed an easy way to access a currently focused element.
Add it to your project:
npm install --save find-focused-element
Import using ES Modules:
import findFocusedElem from 'find-focused-element';
Or as a CommonJS:
const findFocusedElem = require('find-focused-element');
const elem = findFocusedElem(window.document);
The library has been tested in:
- Latest Edge, Firefox, Chrome, Opera, Safari (Mac)
- iOS 11 Safari
- IE 8-11
If you want to support me
Follow me on Youtube or GitHub if you want me to continue.