Giter Club home page Giter Club logo

track-focus's Introduction

Hi, I'm Jeremy LinkedIn Badge

I'm a Development Director at Viget. We build top-notch campaign, organizational, and large content sites on WordPress and Craft.

What Input jsDelivr hits (npm)

I'm the author and maintainer of What Input, a helpful little accessibility-minded script that detects how a page is being interacted with in real time so developers and designers can build more useful and beautiful UIs.

Readme Card

Selected Writing

track-focus's People

Contributors

ten1seven avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

track-focus's Issues

Can't install with NPM

npm ERR! addLocal Could not install /tmp/npm-10529-4a3e75ba/git-cache-852364e5/2a2caef4e67a0d065af6199350e00bfefca8e332
npm ERR! Linux 4.4.0-97-generic
npm ERR! argv "/home/troy/.nvm/versions/node/v7.0.0/bin/node" "/home/troy/.nvm/versions/node/v7.0.0/bin/npm" "i"
npm ERR! node v7.0.0
npm ERR! npm  v3.10.8

npm ERR! No name provided in package.json
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/troy/development/ShoplandV5/npm-debug.log

This is installing it by adding

  "track-focus": "https://github.com/ten1seven/track-focus.git#1.0.0",

to my package.json file. Any ideas? Is this on NPM because I can't find it.

The version on the demo page works whereas the code in the repo does not

Both are marked as v0.2 but the one on the demo page:

/*! track-focus v 0.2 | Author: Jeremy Fields [[email protected]], 2014 | License: MIT */
// inspired by: http://irama.org/pkg/keyboard-focus-0.3/jquery.keyboard-focus.js

(function(body) {

    var usingMouse;

    var preFocus = function(event) {
        usingMouse = (event.type === 'mousedown');
    };

    var addFocus = function(event) {
        if (usingMouse)
            event.target.classList.add('focus--mouse');
    };

    var removeFocus = function(event) {
        event.target.classList.remove('focus--mouse');
    };

    var bindEvents = function() {
        body.addEventListener('keydown', preFocus);
        body.addEventListener('mousedown', preFocus);
        body.addEventListener('focusin', addFocus);
        body.addEventListener('focusout', removeFocus);
    };

    bindEvents();

})(document.body);

works fine.

Compared to the one in the repo which does not

/*! track-focus v 0.2 | Author: Jeremy Fields [[email protected]], 2014 | License: MIT */
// inspired by: http://irama.org/pkg/keyboard-focus-0.3/jquery.keyboard-focus.js

(function(body) {

    var lastDeviceUsed;

    var preFocus = function(event) {
        lastDeviceUsed = (event.type === 'mousedown') ? 'mouse' : 'keyboard';
    };

    var addFocus = function(event) {
        event.target.classList.add('focus--' + lastDeviceUsed);
    };

    var removeFocus = function(event) {
        event.target.classList.remove('focus--keyboard');
        event.target.classList.remove('focus--mouse');
    };

    var bindEvents = function() {
        body.addEventListener('keydown', preFocus);
        body.addEventListener('mousedown', preFocus);
        body.addEventListener('focusin', addFocus);
        body.addEventListener('focusout', removeFocus);
    };

    bindEvents();

})(document.body);

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.