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

Tabbing should navigate input boxes #52

Open
tombh opened this issue Jun 22, 2018 · 20 comments
Open

Tabbing should navigate input boxes #52

tombh opened this issue Jun 22, 2018 · 20 comments

Comments

@tombh
Copy link
Member

tombh commented Jun 22, 2018

No description provided.

@parkerlreed
Copy link

Noticing this here on a machine without mouse input. Tab by itself is doing the exact same thing as Ctrl + Tab (And if you only have one tab open it does absolutely nothing)

@tombh
Copy link
Member Author

tombh commented Jul 10, 2018

What terminal is this?

@mozzwald
Copy link

I've tested browsh on a Zipit Z2 which has no mouse input (or gui for that matter) in an ash shell over SSH running inside tmux. There is no way to interface with the contents of the webpage (clicking links, input boxes, etc) solely with keyboard input. Issue is the same with gnome terminal from PC, although mouse input does work as expected. Perhaps this should be a separate issue/feature request?

Some Zipit browsh screenshots https://imgur.com/a/mwzmtzX

@parkerlreed
Copy link

@tombh I've ran into the same issue on Konsole (Plasma 5) and plain TTY.

@tombh
Copy link
Member Author

tombh commented Jul 11, 2018

@mozzwald!!! Wow, that's so cool :) Thanks for posting. I think you'd be better off following #31 as that's a more comprehensive solution to keyboard interaction.

@parkerlreed Can you send ./debug.log (browsh -debug) with some lines of you pressing TAB on its own and pressing CTRL+TAB. I'll install Konsole myself as well, see what I can see.

@parkerlreed
Copy link

parkerlreed commented Jul 11, 2018

@tombh I opened browsh (1.3.2) with debug, pressed Ctrl T for new tab, pressed tab by itself 6 times (switched tabs), and Ctrl Tab 6 times (also switched tabs, as expected)

Attempting to connect to Firefox Marionette
Starting Firefox in headless mode
Using default profile at: /home/parker/.config/browsh/firefox_profile
FF-CONSOLE: 1531321701818	Marionette	INFO	Listening on port 2828
FF-MRNT: 50:{"applicationType":"gecko","marionetteProtocol":3}
Sending `newSession` to Firefox Marionette
FF-MRNT: 525:[1,0,null,{"sessionId":"2ffb3ee8-15a7-490a-a518-3319c600983c","capabilities":{"browserName":"firefox","browserVersion":"61.0.1","platformName":"linux","platformVersion":"4.17.3-1-ARCH","pageLoadStrategy":"normal","acceptInsecureCerts":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"rotatable":false,"moz:accessibilityChecks":false,"moz:headless":true,"moz:processID":19025,"moz:profile":"/home/parker/.config/browsh/firefox_profile","moz:useNonSpecCompliantPointerOrigin":false,"moz:webdriverClick":true}}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 13:[1,1,null,{}]
Sending `executeScript` to Firefox Marionette
FF-MRNT: 25:[1,2,null,{"value":null}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 13:[1,3,null,{}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 13:[1,4,null,{}]
Sending `executeScript` to Firefox Marionette
FF-MRNT: 25:[1,5,null,{"value":null}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 13:[1,6,null,{}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 13:[1,7,null,{}]
Sending `executeScript` to Firefox Marionette
FF-MRNT: 25:[1,8,null,{"value":null}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 13:[1,9,null,{}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,10,null,{}]
Sending `executeScript` to Firefox Marionette
FF-MRNT: 26:[1,11,null,{"value":null}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,12,null,{}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,13,null,{}]
Sending `executeScript` to Firefox Marionette
FF-MRNT: 26:[1,14,null,{"value":null}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,15,null,{}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,16,null,{}]
Sending `executeScript` to Firefox Marionette
FF-MRNT: 26:[1,17,null,{"value":null}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,18,null,{}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,19,null,{}]
Sending `executeScript` to Firefox Marionette
FF-MRNT: 26:[1,20,null,{"value":null}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,21,null,{}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,22,null,{}]
Sending `executeScript` to Firefox Marionette
FF-MRNT: 26:[1,23,null,{"value":null}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,24,null,{}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,25,null,{}]
Sending `executeScript` to Firefox Marionette
FF-MRNT: 26:[1,26,null,{"value":null}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,27,null,{}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,28,null,{}]
Sending `executeScript` to Firefox Marionette
FF-MRNT: 26:[1,29,null,{"value":null}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,30,null,{}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,31,null,{}]
Sending `executeScript` to Firefox Marionette
FF-MRNT: 26:[1,32,null,{"value":null}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,33,null,{}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,34,null,{}]
Sending `executeScript` to Firefox Marionette
FF-MRNT: 26:[1,35,null,{"value":null}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,36,null,{}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,37,null,{}]
Sending `executeScript` to Firefox Marionette
FF-MRNT: 26:[1,38,null,{"value":null}]
Sending `setContext` to Firefox Marionette
FF-MRNT: 14:[1,39,null,{}]
Sending `addon:install` to Firefox Marionette
FF-MRNT: 62:[1,40,null,{"value":"{8ff2d753-2dc8-46de-a837-fa28331d9fcf}"}]
Starting Browsh CLI client
Webextension not connected. Message not sent: /tty_size,239,63
Incoming web request from browser
TTY sending: /tty_size,239,63
TTY sending: /new_tab,https://google.com
WEBEXT: Webextension connected to the terminal's websocket server
WEBEXT: Starting to listen to TTY
WEBEXT: BACKGROUND: Frame loop starting
WEBEXT: Message from terminal: /tty_size,239,63
WEBEXT: Requesting browser resize for new TTY dimensions: 239x63
WEBEXT: Not resizing browser window without all of the TTY and character dimensions
WEBEXT: Message from terminal: /new_tab,https://google.com
WEBEXT: Tab undefined received new focus
WEBEXT: New tab created: [object Object]
WEBEXT: Not resizing browser window without all of the TTY and character dimensions
WEBEXT: Active tab 2 does not have a channel, so not requesting a frame
WEBEXT: Tab 2 (Google) registered with background process
WEBEXT: Tab 2 connected for communication with background process
WEBEXT: ["Webextension postCommsInit()"]
WEBEXT: Requesting browser resize for new char dimensions: 9x20
WEBEXT: ["Sending big frames..."]
WEBEXT: Resizing browser window successful (2151x1280)
WEBEXT: [["get screenshot with text: 18ms"]]
WEBEXT: [["position text nodes: 43ms"]]
WEBEXT: ["Sending big frames..."]
WEBEXT: [["get screenshot without text: 15ms"]]
WEBEXT: [["get screenshot with text: 16ms"]]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: [["get screenshot without text: 13ms"]]
WEBEXT: [["get screenshot with text: 23ms"]]
WEBEXT: [["position text nodes: 13ms"]]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["!!MUTATION!!",{}]
WEBEXT: ["Sending big frames..."]
WEBEXT: [["get screenshot without text: 18ms"]]
WEBEXT: [["get screenshot with text: 24ms"]]
WEBEXT: [["position text nodes: 13ms"]]
WEBEXT: [["get screenshot without text: 18ms"]]
WEBEXT: [["get screenshot with text: 24ms"]]
WEBEXT: [["position text nodes: 11ms"]]
TTY sending: /switch_to_tab,2
WEBEXT: Message from terminal: /switch_to_tab,2
WEBEXT: Switched to tab: 2
TTY sending: /switch_to_tab,-1
WEBEXT: Message from terminal: /switch_to_tab,-1
TTY sending: /switch_to_tab,2
WEBEXT: Message from terminal: /switch_to_tab,2
WEBEXT: Switched to tab: 2
TTY sending: /switch_to_tab,-1
WEBEXT: Message from terminal: /switch_to_tab,-1
TTY sending: /switch_to_tab,2
WEBEXT: Message from terminal: /switch_to_tab,2
WEBEXT: Switched to tab: 2
TTY sending: /switch_to_tab,-1
TTY sending: /switch_to_tab,2
WEBEXT: Message from terminal: /switch_to_tab,-1
WEBEXT: Message from terminal: /switch_to_tab,2
WEBEXT: Switched to tab: 2
TTY sending: /switch_to_tab,-1
WEBEXT: Message from terminal: /switch_to_tab,-1
TTY sending: /switch_to_tab,2
WEBEXT: Message from terminal: /switch_to_tab,2
WEBEXT: Switched to tab: 2
TTY sending: /switch_to_tab,-1
TTY sending: /switch_to_tab,2
WEBEXT: Message from terminal: /switch_to_tab,-1
TTY sending: /switch_to_tab,-1
WEBEXT: Message from terminal: /switch_to_tab,2
WEBEXT: Switched to tab: 2
TTY sending: /switch_to_tab,2
WEBEXT: Message from terminal: /switch_to_tab,-1
WEBEXT: Message from terminal: /switch_to_tab,2
WEBEXT: Switched to tab: 2
Sending `quitApplication` to Firefox Marionette
FF-MRNT: 32:[1,41,null,{"cause":"shutdown"}]
*errors.errorString normal
/home/travis/gopath/src/browsh/interfacer/src/browsh/tty.go:95 (0x6deb57)
/home/travis/gopath/src/browsh/interfacer/src/browsh/tty.go:60 (0x6dea8b)
/home/travis/gopath/src/browsh/interfacer/src/browsh/tty.go:42 (0x6de8d9)
/home/travis/.gimme/versions/go1.10.3.linux.amd64/src/runtime/asm_amd64.s:2361 (0x457541)

@parkerlreed
Copy link

if ev.Key() == 9 && ev.Modifiers() == 0 {

	if ev.Key() == 9 && ev.Modifiers() == 0 {
		nextTab()
	}

If I'm reading that correctly, with no modifier it's sending nextTab? So Tab either by itself or with Ctrl are hitting the same case?

@tombh
Copy link
Member Author

tombh commented Jul 13, 2018

OMG, yes you're right. What a silly oversight! Ok I should be able to fix this easily :D

@parkerlreed
Copy link

Any update on this? I see #31 which could work but I feel like tab should be a basic thing without having to learn a whole new set of navigation controls.

@tombh
Copy link
Member Author

tombh commented Jul 20, 2018

Well I looked into fixing this and a it turns out both CTRL+Tab and Tab generate the same event without ev.Modifiers() ever returning anything other than 0 on my machine :/ So I need to just double check the docs in tcell (the excellent TTY lib Browsh uses), my suspicion is that this is intentional because the developer of tcell has a lot to say about the landscape of modern TTY support. If he's intentionally not setting the modifier for CTRL+Tab it will be because it is the most historically correct and most common denominator amongst terminals. I know for fact that for instance CTRL+h and BACKSPACE are impossible to consistently distinguish - so in such a case does it make sense to set the modifier to a non-zero value to indicate that CTRL has been pressed? I suspect it is precisely the same case with CTRL+Tab.

If this is the case what do you think could be a solution? The only one I can see at the moment is to use ALT+Tab to switch tabs. I think Tab is just far too locked into browser's muscle memory to change. Of course the other thing is just to forge ahead with #31 and #146.

@paulrouget
Copy link

Right. There's not way to distinguish Tab and Ctrl-Tab in a TTY.
But Ctrl-PageUp works. Which is also what Firefox uses (along Ctrl-Tab).

Usually, the recommended work around is to tell your terminal to fire another combo on Ctrl-Tab (the terminal can catch it).

So I would recommend binding Ctrl-PageUp/Down, to next/prev tab, and write a wiki page about how to make Ctrl-Tab fire a Ctrl-PageUp event. There's at least an option on Mac (iterm) and Windows (mintty). And I'm sure there are ways on Linux.

@dannycolin
Copy link

I think @paulrouget makes the best suggestion so far.

tombh added a commit that referenced this issue Jul 21, 2018
Only 'next-tab' is currently supported.

You will need to run Browsh with `--debug` then press the key
combination and watch the logs for something like;

`TTY sending: /stdin,{"char":"\u001c","key":28,"mod":2}`

That is the result of having `pressed CTRL+\`. Then add something
like the following to your config file:
```toml
[tty.keys]
next-tab = ["\u001c", "28", "2"]
```

touches #52
@tombh
Copy link
Member Author

tombh commented Jul 21, 2018

Thanks @paulrouget I'd like to implement this. Just 1 catch though, it seems your suggested keys are generating a series of ANSI escape sequence runes instead of a single relevant event. I've submitted an issue over at tcell about it: gdamore/tcell/issues/228

I've also just pushed a commit (to be available in the next version release) that implements a very basic draft of configurable keybindings:


Only 'next-tab' is currently supported.

You will need to run Browsh with --debug then press the key
combination and watch the logs for something like;

TTY sending: /stdin,{"char":"\u001c","key":28,"mod":2}

That is the result of having pressed CTRL+\. Then add something
like the following to your config file:

[tty.keys]
next-tab = ["\u001c", "28", "2"]

@tombh
Copy link
Member Author

tombh commented Jul 24, 2018

This fixes in the previous comment were just released in v1.4.7

@parkerlreed
Copy link

Thanks! Trying the update (1.4.8) tab does indeed not have that same behavior as before. However, I feel like the original issue (tab navigation) is still present. If I open regular Firefox and start pressing tab, I move between the elements and can hit enter to activate whatever is selected. This is completely absent in browsh. Maybe this has to share some work with the open vim bindings issue.

@tombh
Copy link
Member Author

tombh commented Jul 27, 2018

Oh I thought I'd replied to this already (maybe I accidentally replied in a different thread!)

But absolutely, I still need to implement the tabbing to cycle input boxes, it's a pretty fundamental behaviour, and will actually overcome one of the main difficulties of input boxes: finding where to click!

@AntouanK
Copy link

was that ever implemented?
can we add something in the config to enable cycling input boxes with tab?

@Binary-Eater
Copy link

Just wanted to bump the idea of using keyboard input to jump to HTML input fields like buttons. Using something like a mouse is not feasible in environments like TTY consoles.

@marcpawl-arista
Copy link

Show stopper for me also. Working through docker containers, mouse works sort of.

@f0o
Copy link

f0o commented Jul 17, 2024

Any update to this?

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

9 participants