简体   繁体   中英

Force soft keyboard to show on focused input in HTML

Currently I'm creating a smart TV app for several brands. A local equipment shop is willing to let me test the app on their televisions. All bugs I found aren't that hard to fix, except for one on the Panasonic devices.

The app is launched through the Panasonic IPTV Apps Developers (HTML5) App SDK. I have a login screen with several input-fields, yet when one is focused the keyboard won't show. Because of this I can not enter any information and I'm unable to leave or change my focus in the form.

The first input-field has an autofocus. I removed the autofocus thinking it had something to do with a focus event not registering or something similar. But after a manual interaction with the input-field, the field is focussed but there is no keyboard that shows up.

Example of my HTML input-field:

<!-- Input username -->
<div class="row">
    <div class="col-xs-11 col-sm-8 col-sm-offset-2">
        <input type="text" class="form-control" name="username" id="username" placeholder="Gebruikersnaam" tabindex="1" autofocus>
    </div><!-- .col -->
</div><!-- .row -->

Example of my Javascript to autofocus the input-field (after a successful login, I navigate a ul (my menu) with the arrow keys of the TV remote, hence the tab-index and forced autofocus.)

$(window).on("load", function() {
    $("[autofocus]").focus();
});

Does anyone here know of another solution I can try that may resolve my problem?

You can try this-

In javascript the prompt() opens the soft keyboard.

You can try opening the keyboard on focus event of the input field and to make it auto-focused you can do this.

$(textFiled).trigger("focus");

Also, wait for the DOM to load completely. Hopes this works for your device.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM