Small library that adds CSS class to html when user starts tabbing, and removes it if user clicks anywhere.
This enables you to have focus outline only when user is using keyboard.
Get it from npm
npm install --save has-tabbed
and use it
;const tabbed = ;
That's it. By default library is activated when instance is created.
You can control it manually by using
// Removes all listeners and CSS classtabbed;// Adds listeners againtabbed;
Then you can use
--tabbed class in your CSS
/* This is naive example used in the demo */
By default library will add
--tabbed class to
To change it just pass custom class name when creating an instance.
;const tabbed = 'my-super-duper-class';
Old school usage
You should use ES modules, but you can use it directly in the browser.
<!-- copy "has-tabbed.js" to your project -->