Renato Carvalho
Renato Carvalho

Reputation: 91

Android Keyboard triggered on button click using Ext JS 7.2

I am working on an Ext JS project, we upgraded the sencha ext js from 6.0 to 7.2. Since this update, we are having some issues with Keyboard on Android devices.

The problem is when I have a text field focused (With Keyboard already closed) and then I click on some button, the keyboard is opened.

Steps:

  1. Click on a text field.
  2. Visualize the mobile keyboard.
  3. Click on the Android back button to close the mobile keyboard.
  4. Visualize that the text field kept focused.
  5. Click on the button component.
  6. Visualize that the keyboard was opened.

PS.: Should mention that on the older version of sencha we don't have this problem. On this older version, the focus is kept on the field but when it is clicked on a button, the focus is removed and we don`t have the keyboard opened.

Thank you, Renato.

Upvotes: 0

Views: 228

Answers (1)

Arthur Rubens
Arthur Rubens

Reputation: 4706

Found this bug in modern toolkit. The problem is in button, when you click on it it does not focused. The following override will help:

Ext.define('Overrides.Button', {
    override: 'Ext.Button',
    doTap: function(me, e) {
        this.focus();
        this.callParent(arguments);
    }
});

Fiddle for reproduction: https://fiddle.sencha.com/#view/editor&fiddle/36rb Fiddle result to open on adroid device with soft keyboard: https://fiddle.sencha.com/fiddle/36rb/preview

You can also see the bug on desktop chrome version, just open the result field in browser, switch to mobile mode in dev tools (console). When you click on the button the focus does not move to button and stays on text field. I think that is the reason the soft keyboard is opening.

Upvotes: 1

Related Questions