Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab navigation stopped when virtual keyboard hidden #275

Closed
Jiguro opened this issue May 26, 2014 · 5 comments
Closed

Tab navigation stopped when virtual keyboard hidden #275

Jiguro opened this issue May 26, 2014 · 5 comments

Comments

@Jiguro
Copy link

Jiguro commented May 26, 2014

Hi,
thanks for working on this jQuery keyboard, it is of great use!

I started using it recently and have observed that when an input field's virtual keyboard is triggered by another element, then tab-key navigation only works when the virtual keyboard is open. If the virtual keyboard is closed, it is not possible to tab away from the concerned input field.

This can be reproduced with the following code example:

<form>
      <input type="text" tabindex="1"/><br>
      <input type="text" tabindex="2"/><span class="keyboard_trigger">Click here!</span><br>
      <input type="text" tabindex="3"/><span class="keyboard_trigger">Click here!</span><br>
      <input type="text" tabindex="4"/>
</form>
$(document).ready(function () {
    $('.keyboard_trigger').on('click', function () {
        var input = $(this).prev('input');

        if (!input.hasClass('ui-keyboard-input')) {
            input.keyboard({
                layout: 'num',
                usePreview: false,
                autoAccept: true,
                tabNavigation: true,
                openOn: null
            });
        }

        input.getkeyboard().focusOn();
        return false;
    });
});

The cause seems to be inside function

base.switchInput = function(goToNext, isAccepted){... // line 869

where in the particular situation above, 3 attributes generate an "undefined" error:

  • base.$keyboard.hide
  • base.$keyboard.show
  • kb.options.openOn

Is there maybe another setting option I missed out that would prevent this tabbing "undefined" error for the way I trigger the keyboard from a sibling element?

With kind regards and many thanks,

jiguro

@Mottie
Copy link
Owner

Mottie commented May 26, 2014

Hi @Jiguro!

When a keyboard is closed (pressing escape, or shift-enter) focus is lost on that input, so the tab indexing won't be in sequence. Which is why the switchInput code was written. It should find the next visible input, textarea, input or link and switch focus to it.

Here is a demo.

You might also want to check out this donation form demo which adds a prev & next button to switch inputs.

These demos and many others can be found on the wiki home page

@apod42
Copy link

apod42 commented Aug 22, 2014

Hello,

I am facing the same problem as jiguro.

Here is a demo: http://jsfiddle.net/Em8sG/3024/

Tab navigation only works with the keyboard opened. If the keybord is closed, pressing tab does nothing...

@apod42
Copy link

apod42 commented Aug 22, 2014

Mottie, in the demos you provided, the keyboard is triggered when the user clicks inside the input. It always remains opened, so the problem does not appear. Please see my demo, with the keyboard triggered by clicking on an image.

@Mottie
Copy link
Owner

Mottie commented Aug 23, 2014

Hi @apod42!

I just pushed a fix for this into the working branch. Thanks for sharing a demo of this issue!

@Mottie Mottie closed this as completed in fe0e153 Nov 20, 2014
@Mottie
Copy link
Owner

Mottie commented Nov 20, 2014

Ok, this should be fixed in 1.19.0. Thanks for your patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants