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

has-tabbed

v1.0.4

Published

Small library that adds CSS class to html when user starts tabbing, and removes it if user clicks anywhere.

Readme

has-tabbed

npm version npm downloads

:focus-visible

Today, :focus-visible is widely supported, so you probably want to use that instead of this library. However, I'll keep it around for posterity and poor souls that still have to support old browsers.

What is this?

Small library that adds CSS class to html when user starts using keyboard to navigate, and removes it if user clicks anywhere.

This enables you to have focus outline only when user is using keyboard.

Demo | Blog post

Usage

Get it from npm

npm install --save has-tabbed

and use it

import HasTabbed from 'has-tabbed';

const tabbed = new HasTabbed();

That's it. By default library is active when instance is created. You can control it manually by using addEvents and removeEvents methods.

// Removes all listeners and CSS class
tabbed.removeEvents();

// Adds listeners again
tabbed.addEvents();

Then you can use has-tabbed class in your CSS

/* This is naive example used in the demo */
* {
  outline: 3px solid transparent;
  outline-offset: 0.3rem;
}

.has-tabbed *:focus {
  outline: 3px solid #409ad7;
}

Options

Library accepts a single options object with the following properties:

  • className (default has-tabbed)

    CSS class name which will be added to the html element.

  • triggerOnAllKeys (default false)

    If you want to add CSS class on all keyboard events not only when user presses tab, change this one to true

import HasTabbed from 'has-tabbed';

const tabbed = new HasTabbed({
  className: 'navigating-using-keyboard',
  triggerOnAllKeys: true,
});

v1.0.0 breaking changes

  • className property is now replaced with an options object.
  • Default class name is changed from --tabbed to has-tabbed.

Old school usage

You should use ES modules, but you can use it directly in the browser.

<!-- copy "has-tabbed.js" to your project -->
<script src="has-tabbed.js"></script>
<script>
  var tabbed = new HasTabbed();
</script>