MarZab / FxKeyboard

A virtual keyboard for Firefox
https://addons.mozilla.org/firefox/addon/fxkeyboard/
GNU General Public License v3.0
11 stars 23 forks source link

Tab key #2

Closed cartmen closed 9 years ago

cartmen commented 12 years ago

Is there a possible chance that you add a tabulator key to FxKeyboard? It would be really great.

MarZab commented 12 years ago

Here's the code for a tab character button:

<button label="Tab" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('\t')" />
cartmen commented 12 years ago

This line works in a text editor but what I need is a tabulator key to navigate with a browser or for bash completion.

MarZab commented 12 years ago

Don't know if those are possible from a firefox extension, sending a key event to the element does not work.

cwill747 commented 12 years ago

You can emulate a tab function between fields in a form using JQuery. It won't act like a true tab key per se, but it would allow you to move between fields. Only problem is that it would involve linking jquery... @MarZab I'll can write a patch for it if you'd like.

You'd just have to agree to link it to jquery :P Can always used the minimized version, wouldn't add overhead really.

MarZab commented 12 years ago

If jQuery can do it, then regular JavaScript can. Also, I don't know the implications of letting jQuery into XUL. @cartmen wanted bash completion so even this would not do it.

cwill747 commented 12 years ago

From what I've seen, it seems to be safe (just did some googling). There's even a lib for it - https://github.com/ilyakharlamov/jquery-xul that handles the quirks. And @cartmen did say navigate with a browser or for bash completion, so maybe it's still desirable? I'll probably write it anyways, I could use the functionality in my instance. Up to you if you want to pull it later.

And I agree that if jquery can do it, then regular js can, but why re-invent the wheel?

MarZab commented 12 years ago

We could in-cooperate this with the toolbar idea. Have someone drag-n-drop the key onto the keyboard. jQuery would be included as needed.

cwill747 commented 12 years ago

Very true. Would the toolbar be a true firefox XUL toolbar? As in you can drag firefox buttons in? Or would it be our own "toolbar", where we define the keys.

MarZab commented 12 years ago

A real one would be best.

cartmen commented 12 years ago

I think that navigation with tab key would be great if possible with FxKeyBoard. Bash completion isn't an important use case.

MarZab commented 12 years ago

Bash completion is probably tied to a keyboard event, so by making one that will be able to tab, bash completion would be working as well.

I was looking into this issue, going through gecko and I could not find anything yet. Also, I think input fields are OS regulated so I have a feeling this might not even be possible.

Another option is to check out Firefox OS and see what they came up with.

MarZab commented 9 years ago

Here is a sample of how a not so clever solution:

doTab: function () {

    var inputs = ((fxKeyboard.focus || {}).ownerDocument || {}).querySelectorAll('input,textarea');
    if (inputs) {
        for (var i = 0; i < inputs.length; i++) {
            if (inputs[i] === fxKeyboard.focus) {
                // ok, focus next one
                inputs[i + 1].focus();
                break;
            }
        }
    }

}
MarZab commented 9 years ago

Version 3 has this integrated, closing the issue.