@devlop/tabwrap
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

Latest Stable Version License

tabwrap

Minimalistic utility to add tab wrapping to any element, such as dialogs and popups.

Installing

using npm

npm install @devlop/tabwrap

Usage

<div class="dialog">
    <input type="text"> <!-- switch + tab here should switch focus to the last <input> -->
    <input type="text">
    <input type="text"> <!-- tab here should switch focus to the first <input>-->
</template>
import tabwrap from '@devlop/tabwrap';

tabwrap(document.querySelector('div.dialog'));

Simplified usage on multiple elements

If you have many places you want to add tab wrapping it can usefull to give all your elements you wish to target the same attribute, for example data-tabwrap, then it's easy to add tab wrapping to them all like this.

import tabwrap from '@devlop/tabwrap';

document.querySelectorAll('[data-tabwrap]').forEach(function (element) {
    tabwrap(element);
});

/@devlop/tabwrap/

    Package Sidebar

    Install

    npm i @devlop/tabwrap

    Weekly Downloads

    1

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    9.98 kB

    Total Files

    5

    Last publish

    Collaborators

    • johanrosenson