npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

storybook-addon-keyboard-nav-visualizer

v1.0.1

Published

Visualize keyboard navigation, tab order, and focus management in Storybook

Readme

Storybook Addon: Keyboard Navigation Visualizer

A Storybook addon that helps you visualize keyboard navigation, tab order, and focus management in your components. Perfect for testing accessibility (a11y) and ensuring proper keyboard navigation flows.

Version License

Features

Visual Tab Order — See numbered badges on all focusable elements showing the tab order
⌨️ Keyboard Event Tracking — Track all keyboard events in real-time with timestamps
👁️ Focus Overlay — Highlight the currently focused element with a blue border
📋 Focus History — View a log of all focused elements during your testing session
🎛️ Customizable Settings — Toggle features on/off including overlay, badges, and history tracking
Accessibility Testing — Identify keyboard navigation issues and WCAG compliance problems

Installation

npm install --save-dev storybook-addon-keyboard-nav-visualizer
# or
yarn add --dev storybook-addon-keyboard-nav-visualizer

Setup

Add the addon to your Storybook configuration in .storybook/main.js (or main.ts):

// .storybook/main.js
module.exports = {
  stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
  addons: [
    'storybook-addon-keyboard-nav-visualizer',
    // ... other addons
  ],
};

Usage

1. Enable the Visualizer

  • Open any story in Storybook
  • Click the ⌨️ Keyboard Nav button in the toolbar (top right)
  • The addon will activate and show tab order badges on focusable elements

2. Test Keyboard Navigation

  • Press Tab to navigate through focusable elements
  • Watch the blue focus overlay highlight the current element
  • View key press history in the panel showing all keys pressed with timestamps
  • View focus history in the panel showing the order of focused elements

3. Customize Settings

In the Keyboard Navigation panel, toggle settings:

  • Show Focus Overlay — Display blue border around focused element
  • Show Tab Index — Display numbered badges on focusable elements
  • Highlight on Focus — Automatically highlight elements when focused
  • Track History — Record keyboard and focus events

How It Works

Tab Order Detection

The addon automatically detects all focusable elements:

  • <a href> links
  • <button> elements
  • <input> fields
  • <select> dropdowns
  • <textarea> elements
  • Elements with [tabindex] attribute
  • Elements with [contenteditable="true"]

Elements are sorted by their natural tab order based on tabindex values and DOM position.

Real-Time Updates

  • Tab Order updates automatically when elements are added/removed from the DOM
  • Keyboard Events are logged as you press keys
  • Focus Events are tracked as you navigate with Tab/Shift+Tab

Event History

All events are logged with precise timestamps showing:

  • Key Press History: Key name, code, target element, and timestamp
  • Focus History: Focused element selector and timestamp
  • Max 50 key presses and 30 focus changes stored (older events removed)

Example Story

// Button.stories.js
import Button from './Button';

export default {
  title: 'Components/Button',
  component: Button,
};

export const Primary = () => (
  <div>
    <Button>Click Me</Button>
    <Button>Another Button</Button>
    <a href="#test">Link</a>
    <input type="text" placeholder="Text input" />
  </div>
);

Enable the keyboard navigation visualizer to see:

  1. Numbered badges (1, 2, 3, 4) on each element
  2. Blue focus overlay as you tab through
  3. Key press and focus events logged in the panel

Keyboard Shortcuts

  • Tab — Navigate forward
  • Shift + Tab — Navigate backward
  • Enter/Space — Activate buttons/links
  • Arrow Keys — Navigate in select/radio groups

All keyboard interactions are logged in the Key Press History.

Settings Explained

| Setting | Purpose | |---------|---------| | Show Focus Overlay | Displays a blue border around the currently focused element | | Show Tab Index | Shows numbered badges (1, 2, 3...) on focusable elements | | Highlight on Focus | Automatically highlights elements when they receive focus | | Track History | Records keyboard and focus events in the panel |

Common Issues

No tab order badges showing

  • Make sure Show Tab Index is enabled in settings
  • Ensure focusable elements are visible (not hidden with display: none)
  • Check that elements are actually focusable (buttons, links, inputs, etc.)

Focus overlay not appearing

  • Enable Show Focus Overlay in settings
  • Ensure Highlight on Focus is enabled
  • Try tabbing to an element manually

History not tracking

  • Enable Track History in settings
  • Make sure you're pressing keys or tabbing through elements
  • Clear history with the "Clear" button to see fresh events

Browser Support

Works with all modern browsers:

  • Chrome/Edge 90+
  • Firefox 88+
  • Safari 14+

Contributing

Found a bug or have a feature request? Open an issue on GitHub

License

MIT © Vaibhav Tandon

Resources