Remove focus from canvas

1k views Asked by At

How can I remove focus from canvas and give it to input fields in my HTML? Currently the canvas retains focus even though I'm actively clicking on HTML text inputs. Therefore it is actually impossible to even write something into them.

Ideally it would lose focus when my mouse is outside of the div it is in.

1

There are 1 answers

0
user3262713 On

Solution:

Had this in my IO.js file...

document.addEventListener('mousedown', function(event)
{   
    event.preventDefault(); // This prevented focus on the input fields..
    // Mouse button clicked
    switch (event.which)
    {
        case 1:
            // Left Mouse button pressed.
            mouse.left = true;
            break;
        case 2:
            // Middle Mouse button pressed.
            mouse.middle = true;
            break;
        case 3:
            // Right Mouse button pressed.
            mouse.right = true;
            break;
    }

});

Really stupid problem, sorry to bother you with it.