[SOLVED] Keyboard not working

I built some custom html and CSS to put a text entry box on top of one of my 2D UI’s, but the keyboard input isn’t working. Is that something to do with the same code swallowing keypresses maybe? Is this pretty usual? Is that what the propagate stuff does - suppress keyboard clicks?


Can you post a link to the project please?

As far as I know, there is nothing native that swallows the event.

I had a script running that was disallowing ‘default’ events. I made that conditional and it worked. It may be worth putting something like I have into the HTML/CSS example. There are some gotchas in getting text entry going - gets into esoteric js ‘this’ stuff.

HTML has this:

<input type="text" class="playername" placeholder='Player Name' value="Test Name"/>

And then in code:

    var playername = this.div.querySelector('.playername');
    this.handleEvent = function (event) {
    console.log(this.name); // 'Something Good', as this is the Something object
    switch (event.type) {
      case 'click':
       case 'dblclick':
        if (playername)
                console.log ("Player Name: " + playername.value);

        console.log ('button clicked');
        document.body.removeChild (this.div);
        this.div = null;
        this.app.fire ("ui:player", playername.value);
        this.app.fire ("ui:start");

      // Note that the listeners in this case are this, not this.handleEvent
    button.addEventListener ('click', this, false);
    button.addEventListener ('dblclick', this, false);