Skip to content

Keyboard steals focus on initialization #811

@downace

Description

@downace

JSFiddle: https://jsfiddle.net/6gd3y71u/24/

I have two inputs: one with the virtual keyboard, another one with autofocus.

When keyboard initializes, it steals focus from the second input.

Currently I'm using following monkey-patch to workaround this issue:

require('virtual-keyboard/dist/js/jquery.keyboard.js');

const original_checkCaretSupport = $.keyboard.checkCaretSupport;
$.keyboard.checkCaretSupport = function() {
    const focused = document.activeElement;
    original_checkCaretSupport();
    if (focused && document.activeElement !== focused && focused.focus) {
        focused.focus();
    }
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions