jscher2000 / switch-to-previous-active-tab

Firefox toolbar button to switch to the last accessed tab (and MRU popup)
Mozilla Public License 2.0
8 stars 1 forks source link

Keyboard navigation in list #13

Closed Dim-Tim-1963 closed 1 year ago

Dim-Tim-1963 commented 1 year ago

Is it possible to 1) Add a keyboard shortcut to open popup with list? 2) Allow keyboard navigation in list (at least down, up, enter to select, esc to close)? I got used to tab groups addon, and now Ctrl-Tab is limited to active group. With keyboard navigation enabled, your addon would be a gread alternative to Ctrl-Tab. :)

jscher2000 commented 1 year ago

For (1), yes, that's easy. I'm going to upload a version 2.3 now with this feature.

For (2), Esc should close it already, but the other scripts will take some time to write and test.

Dim-Tim-1963 commented 1 year ago

Thanks! :)

jscher2000 commented 1 year ago

Version 2.4 has my initial design for keyboard support:

I tested in a very simplified scenario (no container tabs or hidden tabs) since it was getting late. Let me know how it goes.

Dim-Tim-1963 commented 1 year ago

Great! I don't use container tabs, but with Tab Groups works flawlessly. Perhaps one more thing to add: close popup on ENTER (maybe optionally).

jscher2000 commented 1 year ago

I noticed that the list doesn't scroll automatically when I arrow down, so I'll open a new issue for that.

Regarding the list staying open, you could switch over to the Options tab to see whether the box to keep it open is checked:

List-stays-open

Dim-Tim-1963 commented 1 year ago

Yes, unchecking that option helps. But when it's checked, and I press Enter to select a tab, the tab gets focus, but now only ESC works, and Up, Down and Enter are ignored.

jscher2000 commented 1 year ago

Yes, Firefox moves the focus into the page in the tab that was activated, so your arrows go there instead.

There probably is a way to move the focus back to the popup after the tab settles -- from the popup. I'd rather not inject scripts into pages to do that if it can be avoided. Do you want to open a new issue for that?

Dim-Tim-1963 commented 1 year ago

After the page is activated, arrow keystrokes go nowhere: Up and Down should scroll the page, but they don't. But I found out that pressing TAB "unfreezes" the list, and Up/Down/Enter act as they should again. Maybe it's a clue. And personally I am good with closing popup after pressing Enter. :)