0.1.7 • Published 9 months ago

@ciceksepeti/cui-focus-trap v0.1.7

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@ciceksepeti/cui-focus-trap

npm version storybook PRs Welcome license

Component that traps focus within a DOM node A focus trap ensures that tab and shift + tab keys will cycle through the focus trap's tabbable elements but not leave the focus trap. This is great for making accessible modals.

Installing

Using Npm:

$ npm install @ciceksepeti/cui-focus-trap

Using Yarn:

$ yarn add @ciceksepeti/cui-focus-trap

Example

import FocusTrap from "@ciceksepeti/cui-focus-trap";

function Demo() {
  return (
    <FocusTrap>
      <div>
        <button>focusable</button>
        <button>focusable</button>
        <button>focusable</button>
        <button disabled>disabled</button>
        <button style={{ visibility: "hidden" }}>hidden</button>
        <button tabIndex={-1}>tabindex -1</button>
        <button>focusable</button>
      </div>
    </FocusTrap>
  );
}
0.1.7

9 months ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.2

2 years ago

0.1.3

2 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago