• Version 0.10.1
  • Published
  • 55.8 kB
  • 1 dependency
  • MIT license


npm i focus-lock
yarn add focus-lock
pnpm add focus-lock


DOM trap for a focus



variable tabHook

const tabHook: { attach(): void; detach(): void };


    function focusInside

    focusInside: (topNode: HTMLElement | HTMLElement[]) => boolean;

      function focusIsHidden

      focusIsHidden: () => boolean;

        function focusMerge

        focusMerge: (
        topNode: HTMLElement | HTMLElement[],
        lastNode: HTMLInputElement | null
        ) => NodeIndex | { node: HTMLInputElement } | undefined;

          function focusNextElement

          focusNextElement: (baseElement: Element, options?: FocusNextOptions) => void;

            function focusPrevElement

            focusPrevElement: (baseElement: Element, options?: FocusNextOptions) => void;

              function getAllAffectedNodes

              getAllAffectedNodes: (node: HTMLElement | HTMLElement[]) => HTMLInputElement[];

                function getFocusabledIn

                getFocusabledIn: (topNode: HTMLElement) => FocusableIn[];

                  function setFocus

                  setFocus: (
                  topNode: HTMLElement,
                  lastNode: HTMLInputElement,
                  options?: FocusLockFocusOptions
                  ) => void;


                    namespace constants

                    module 'dist/es5/constants.d.ts' {}

                      variable FOCUS_ALLOW

                      const FOCUS_ALLOW: string;

                        variable FOCUS_AUTO

                        const FOCUS_AUTO: string;

                          variable FOCUS_DISABLED

                          const FOCUS_DISABLED: string;

                            variable FOCUS_GROUP

                            const FOCUS_GROUP: string;

                              Package Files (10)

                              Dependencies (1)

                              Dev Dependencies (2)

                              Peer Dependencies (0)

                              No peer dependencies.


                              To add a badge like this badgeto your package's README, use the codes available below.

                              You may also use to create a custom badge linking to

                              • Markdown
                              • HTML
                                <a href=""><img src="" alt=""></a>