Mottie / Keyboard

Virtual Keyboard using jQuery ~
http://mottie.github.io/Keyboard/
Other
1.77k stars 722 forks source link

Keyboard's value doesn't get updated programmatically and it closes as well #809

Closed sajalsuraj closed 2 years ago

sajalsuraj commented 2 years ago

Hi,

I am using this keyboard in an Angular project, my requirement is to update the keyboard value programmatically, but the moment value reaches the point, the keyboard got closed. This happens when the angular page/component is navigated more than once.

This is the function that I wrote to update the value -

addNewScannedValue(val){
    var keyboard = $('.input-keyboard').getkeyboard();
    var k = keyboard
      .reveal()
      .setValue(val)
      .$el.trigger('change');
  }

Value doesn't get updated on the keyboard and the keyboard closes automatically. Please help me. @Mottie

contra8 commented 2 years ago

Which version of Angular are you using? The latest, Angular 12?

sajalsuraj commented 2 years ago

@contra8 I am using Angular 8.

sajalsuraj commented 2 years ago

I have resolved this problem. I have removed the keyboard events such as getKeyboard() and reveal() and just using "keyboard.$preview.focus()". This resolved my issue. Closing this issue for now.