Closed cartmen closed 9 years ago
Here's the code for a tab character button:
<button label="Tab" class="fxKeyboardKey" oncommand="fxKeyboard.doKey('\t')" />
This line works in a text editor but what I need is a tabulator key to navigate with a browser or for bash completion.
Don't know if those are possible from a firefox extension, sending a key event to the element does not work.
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.
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.
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?
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.
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.
A real one would be best.
I think that navigation with tab key would be great if possible with FxKeyBoard. Bash completion isn't an important use case.
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.
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;
}
}
}
}
Version 3 has this integrated, closing the issue.
Is there a possible chance that you add a tabulator key to FxKeyboard? It would be really great.