Coder Social home page Coder Social logo

tabby.js's Introduction

Tabby.js

Never neglect your tabs when it comes to usability again! Making tabindex easy for custom elements to improve your UX.

Purpose

In today's JavaScript environment with all the custom elements, it's easy to forget that tabbing is an integral part of the UX. With HTML5 you can define tabindex on any property, but you need additional functionality for it to do anything useful. That's where Tabby becomes useful! By emitting two custom events when tabbing occurs, you can define the behaviour with ease.

 

Install with npm: npm install tabby-js

Getting Started

Tabby emits two custom events for you to listen for. These can be listened to the vanilla JavaScript way (.addEventListener('tabEnter')) or the jQuery way (.on('tabEnter')) – other libraries are supported as long as they tap into the vanilla JavaScript events.

tabEnter

Emitted when an element with a `tabindex` attribute has focus with the tab key – allowing you to highlight the element, or to open your faux-select.

tabLeave

Emitted irrespective of whether the tab key was involved (an alias of `onblur`) – allowing you to reset the element's state.
// Emitted when a user tabs into the box.
elements.on('tabEnter', function() {
    $(this).addClass('focus');
});

// Emitted each and every time (same as onblur).
elements.on('tabLeave', function() {
    $(this).removeClass('focus');
});

Contributions

I'd be over the moon for contributions for any of my projects – including of course Tabby! If you would like to contribute, please fork and issue a pull request and I'll happily merge it in to master.

tabby.js's People

Contributors

wildhoney avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.