Git Product home page Git Product logo

js-onscreen-keyboard's Introduction

JS OnScreen Keyboard

What do I use this for

Web apps that need a touchscreen keyboard.

How to use this

var inputs = document.forms["demo"].getElementsByTagName("input");
var keyboardHost = document.querySelector('.keyboard-host');
var keyboard = new window.Keyboard(inputs, keyboardHost);

Check out demo.html for example.

Goals

  • Minimal dependency
  • Works outta the box with vanilla javascript, can be integrated easily to frameworks too
    • Or at least our Backbone apps
  • Has the same behavior click v.s. touch
  • Allows control over its show/hide, create/destroy
  • Allows customization
    • layout
    • style / skin
    • special keys with custom functionalities

Dev Roadmap

  • Generate Keyboard HTML & insert them to a designated element

    • Make it work w/ 3 buttons first
  • Whenever a key is clicked or touched, it would fire an event that keyboard handles

  • Converge all events to a single handler

  • Keyboard can keep track of which element it should update

  • When there is an element the keyboard's focusing on, pressing keys inserts value to it

  • Value inserting works just like actual keyboard, takes caret place and selection into consideration

  • Destroy function to unbind and destroy html

  • Layouts are defined by config json file and can be swapped

  • Keys may insert a different character than its label

  • Common functionality keys

    • backspace
    • tab
  • A system to easily attach new func keys

    • 'func' property in layout files used to differentiate b/c keys
    • public function to attach functions to run for keys w/ diff func
    • Keys can have same func but different additional info too, and handlers have access to that
  • Bug: When input's content is longer than input box's width, it should move the cursor to show the caret

    • Easy way to do this is via setting focusedEl.scrollLeft to a high number. This would however always jump to the end of input no matter where the caret's at.
    • To make this intelligent we need some method of calculating caret's pixel location?
  • Generated keys have a structure that allows easy style changing via CSS

  • Platform testing

  • Click, Touch, Chrome's touch simulation, and FastClick.js driven touch event should all behave the same

  • Getters to make many type checkings easier?

    • setLayout
    • focusedEl?
    • keyboardEl?
  • Support more browsers than just Chrome

js-onscreen-keyboard's People

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-onscreen-keyboard's Issues

Should we let the keyboard emit 'change' event with every input?

The word 'change' makes sense to be used for our effects on <input>, <select>, or <textarea>. However the behavior is inconsistent depending on which input method we use, and on which platform.

https://developer.mozilla.org/en-US/docs/Web/Events/change

Different browsers do not always agree whether a change event should be fired for certain types of interaction. For example, keyboard navigation in elements never fires a change event in Gecko until the user hits Enter or switches the focus away from the

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.