MozillaZine


keyconfig 20110522

Announce and Discuss the Latest Theme and Extension Releases.
Qwerky

User avatar
 
Posts: 116
Joined: March 5th, 2005, 10:33 pm
Location: Adanac

Post Posted May 14th, 2022, 9:46 am

morat wrote:I think it would be easiest to convert the experiment_apis tbkeys addon. Sorry, I'm not volunteering. :mrgreen:

:lol:
Yes, I would be very happy to have tbkeys in Firefox as well, though I'm not able to undertake such a project. It would be great if someone would!
Mr. Qwerky

bege
 
Posts: 149
Joined: January 23rd, 2009, 9:14 pm
Location: Germany

Post Posted May 22nd, 2022, 11:52 am

Hello,
I want to go to a certain folder in a tbkeys script.
I know how to find the folder URL, but I need the command or function to go to a folder (when I click on a folder in the folder tree).

morat
 
Posts: 5144
Joined: February 3rd, 2009, 6:29 pm

Post Posted May 22nd, 2022, 2:41 pm


bege
 
Posts: 149
Joined: January 23rd, 2009, 9:14 pm
Location: Germany

Post Posted May 22nd, 2022, 4:19 pm

morat wrote:@bege

How to navigate folders
http://github.com/wshanks/tbkeys/issues ... 1005871808


Thanks a lot, morat!

Qwerky

User avatar
 
Posts: 116
Joined: March 5th, 2005, 10:33 pm
Location: Adanac

Post Posted May 23rd, 2022, 2:50 pm

In Firefox, is there a way to place the focus on the tab bar (on the current tab), like placing the focus on the address bar, or the search bar, or the window content? The idea being that once the tab bar is focused, then simple commands like left-arrow/right-arrow would move that focus from the currently focused tab, to the the tab to the left/right, etc.
Mr. Qwerky

morat
 
Posts: 5144
Joined: February 3rd, 2009, 6:29 pm

Post Posted May 25th, 2022, 6:07 am

@Qwerky

Try these:

Code: Select all
gBrowser.selectedTab.focus();

Code: Select all
// select first tab and focus
gBrowser.selectedTab = gBrowser.tabs[0];
gBrowser.selectedTab.focus();

Code: Select all
// select last tab and focus
gBrowser.selectedTab = gBrowser.tabs[gBrowser.tabs.length - 1];
gBrowser.selectedTab.focus();

Qwerky

User avatar
 
Posts: 116
Joined: March 5th, 2005, 10:33 pm
Location: Adanac

Post Posted May 25th, 2022, 1:08 pm

@morat

Thanks. That does indeed focus the current tab, which answers the question posed.

Unfortunately, once focused, a left-arrow or right-arrow does move the focus to the left or right tab, but it also causes that left or right tab to become selected. Given that, I'm not sure that my idea would work.

Some people are mouse-centric, while others are keyboard-centric. The idea was for an extension that would allow moving around and manipulating the tab bar with the keyboard alone, which doesn't seem to be currently available.

So, it would have a hotkey which caused focus to move to the current tab. Then, left-/right-arrow would move focus to the left/right tab, home would move focus to the first tab, end would move focus to the last tab; all without causing the newly focused tab to become selected. Once the desired tab was reached, enter would cause that tab to be selected. Or, ctrl-left/ctrl-right would cause the focused tab to move left/right in the tab bar; ctrl-home/ctrl-end would cause the focused tab to move to the first/last tab position.

Further, while the tabbar is focused, holding shift with left-/right-arrow would allow multiple tabs to be focused, after which they could be moved as a group, left/right/first/last as above. And other actions could be incorporated as well.

But all of this would be dependent upon being able to move focus from tab to tab without actually selecting the tab, which I'm not sure how to do, or even whether it could be done. And if it could, it would still require someone with the ability (and motivation) to create such an extension. As much as I'd like to have that extension, I'm not familiar enough to be able to deal with the Firefox code to that degree.
Mr. Qwerky

morat
 
Posts: 5144
Joined: February 3rd, 2009, 6:29 pm

Post Posted May 30th, 2022, 6:34 am

@Qwerky

I wasn't familar with the "colored border" shortcuts before your post.

Keyboard shortcuts - Selection of Multiple Tabs
http://support.mozilla.org/kb/keyboard- ... tiple-tabs

e.g. F6, Shift+Tab repeatedly, Ctrl+ArrowRight

Try this:

Code: Select all
// select first tab and focus, aria focus second tab
gBrowser.selectedTab = gBrowser.tabs[0];
gBrowser.selectedTab.focus();
gBrowser.tabContainer.ariaFocusedItem = gBrowser.tabs[1];
setTimeout(function () {
  alert(gBrowser.tabContainer.selectedIndex);    // 0
  alert(gBrowser.tabContainer.ariaFocusedIndex); // 1
}, 1000);

The tab terminology is confusing. I'm not sure what's correct.

ARIA: Accessible Rich Internet Applications

Reference
http://searchfox.org/mozilla-release/source/toolkit/content/widgets/tabbox.js (see set ariaFocusedItem)
http://searchfox.org/mozilla-release/source/browser/base/content/tabbrowser-tabs.js (see on_keydown)
Last edited by morat on May 31st, 2022, 9:38 am, edited 1 time in total.

Qwerky

User avatar
 
Posts: 116
Joined: March 5th, 2005, 10:33 pm
Location: Adanac

Post Posted May 30th, 2022, 12:41 pm

Thanks, @morat.

morat wrote:Keyboard shortcuts - Selection of Multiple Tabs
http://support.mozilla.org/kb/keyboard- ... tiple-tabs

e.g. F6, Shift+Tab repeatedly, Ctrl+ArrowRight

The shortcuts in the article linked above do kinda work, sorta... :?

In place of "F6, Shift+Tab..." I used the code you provided earlier:
Code: Select all
gBrowser.selectedTab.focus();

and assigned it to Control-Spacebar for testing. This, then, moves the focus to the currently active tab in the tab bar. Now, left-arrow/right-arrow/home/end (per the article), as I noted previously, do move the focus to the adjacent/first/last tab, but also cause that newly focused tab to become the current tab (and thus displayed in the content window).

Control -left/-right/-home/-end keys (as per the article) also cause the focus to move to a different tab, without causing that new tab to become current; this was the desired behavior. In the case of ctrl-home/-end, the focus is correctly moved to the first/last tab.

However, in the case of ctrl-left/-right, the focus is moved to a different tab which appears to be completely random. It is not necessarily the previous/next tab (though it could be); and it is not necessarily a tab previous-to or following-after the current tab, as it could move in either direction. And a ctrl-left followed by a ctrl-right does not move the focus back to the original tab. In short, it really does appear random, though I'm sure it is not actually random, it is just following some algorithm in the code which is anything but obvious. [I should note that I use a multi-line tab bar (though that shouldn't matter), and am using the Simple Tab Groups add-on, so I have multiple tab groups.] But the strange order of tab selection does appear to be constrained to the tabs which appear within the current group.

Also, though the article section is titled "Selection of Multiple Tabs", I could find no way to actually select multiple tabs.

Try this:

Code: Select all
// select first tab and focus, aria focus second tab
gBrowser.selectedTab = gBrowser.tabs[0];
gBrowser.selectedTab.focus();
gBrowser.tabContainer.ariaFocusedItem = gBrowser.tabs[1];
setTimeout(function () {
  alert(gBrowser.tabContainer.selectedIndex);    // 0
  alert(gBrowser.tabContainer.ariaFocusedIndex); // 1
}, 1000);


I'm not sure what the intended purpose of this code is, but I ran it in the console, and it caused the tab bar to change to a different tab-group, with the first and second tab of that group selected, and additionally some other anomalies which I'm at a loss to describe.

However, the fact that we are now able by keyboard to move tab focus without tab selection, serves as a proof-of-concept. I'm confident that the correct algorithms could be determined to move focus, select, etc. in the desired manner. All that remains is to find someone willing and able to create such an add-on. :lol:
Mr. Qwerky

morat
 
Posts: 5144
Joined: February 3rd, 2009, 6:29 pm

Post Posted May 30th, 2022, 4:37 pm

Qwerky wrote:not sure what the intended purpose of this code is

The code snippet selects the first tab and focuses the second tab.

Screenshot
http://imgur.com/5knERbT

I'm not using any tab groups.

Qwerky

User avatar
 
Posts: 116
Joined: March 5th, 2005, 10:33 pm
Location: Adanac

Post Posted May 30th, 2022, 5:40 pm

morat wrote:The code snippet selects the first tab and focuses the second tab.

I'm not using any tab groups.

Yes, that's what happened, but with side-effects, likely due to using tab groups here.
Mr. Qwerky

bege
 
Posts: 149
Joined: January 23rd, 2009, 9:14 pm
Location: Germany

Post Posted June 3rd, 2022, 2:26 pm

Hello,
this works perfect in the console (open URL in browser)

Code: Select all
(function() {uri = Services.io.newURI('https://www.thunderbird-mail.de/forum/'); Cc['@mozilla.org/uriloader/external-protocol-service;1'].getService(Ci.nsIExternalProtocolService).loadURI(uri); })();


but this in tbkeys does nothing, no error in error console

Code: Select all
"ctrl+q": "(function() {uri = Services.io.newURI('https://www.thunderbird-mail.de/forum/'); Cc['@mozilla.org/uriloader/external-protocol-service;1'].getService(Ci.nsIExternalProtocolService).loadURI(uri); })();"


What must I change?

morat
 
Posts: 5144
Joined: February 3rd, 2009, 6:29 pm

Post Posted June 3rd, 2022, 7:07 pm

@bege

Remember to include the window object in custom commands.

Code: Select all
(function() { var uri = window.Services.io.newURI('https://www.thunderbird-mail.de/forum/'); window.Components.classes['@mozilla.org/uriloader/external-protocol-service;1'].getService(window.Components.interfaces.nsIExternalProtocolService).loadURI(uri); })();

Tips: viewtopic.php?p=14872763#p14872763

You should have gotten a reference error in the console. Try checking the "Show Content Messages" menu item in the console settings menu.

bege
 
Posts: 149
Joined: January 23rd, 2009, 9:14 pm
Location: Germany

Post Posted June 4th, 2022, 11:01 am

morat wrote:@bege

Remember to include the window object in custom commands.

Code: Select all
(function() { var uri = window.Services.io.newURI('https://www.thunderbird-mail.de/forum/'); window.Components.classes['@mozilla.org/uriloader/external-protocol-service;1'].getService(window.Components.interfaces.nsIExternalProtocolService).loadURI(uri); })();

Tips: viewtopic.php?p=14872763#p14872763

You should have gotten a reference error in the console. Try checking the "Show Content Messages" menu item in the console settings menu.


Thank you, morat. I don't know where to put it to not forget it every time. ](*,)
The console settings were checked as you recommend, no error.
I had the entry in the lower box (Compose key bindings). After putting it in the upper box it works. :?:
What are those two boxes meant for?

Qwerky

User avatar
 
Posts: 116
Joined: March 5th, 2005, 10:33 pm
Location: Adanac

Post Posted June 4th, 2022, 12:11 pm

The upper box is for key bindings for the main window; the lower box is for key bindings for the compose window.
Mr. Qwerky

Return to Extension/Theme Releases


Who is online

Users browsing this forum: Bing [Bot] and 3 guests