[GH-ISSUE #243] What are the keyboard shortcuts for changing widget focus? #135

Closed
opened 2026-03-03 16:22:40 +03:00 by kerem · 14 comments
Owner

Originally created by @HouzuoGuo on GitHub (Aug 4, 2020).
Original GitHub issue: https://github.com/mum4k/termdash/issues/243

Originally assigned to: @mum4k on GitHub.

Good day. This wiki article says:

"Focus can be changed using mouse or keyboard shortcuts." https://github.com/mum4k/termdash/blob/master/doc/hld.md

I'm working with a terminal without mouse support. What are the shortcuts for changing focus? Thanks.

Originally created by @HouzuoGuo on GitHub (Aug 4, 2020). Original GitHub issue: https://github.com/mum4k/termdash/issues/243 Originally assigned to: @mum4k on GitHub. Good day. This wiki article says: "Focus can be changed using mouse or keyboard shortcuts." https://github.com/mum4k/termdash/blob/master/doc/hld.md I'm working with a terminal without mouse support. What are the shortcuts for changing focus? Thanks.
kerem 2026-03-03 16:22:40 +03:00
Author
Owner

@HouzuoGuo commented on GitHub (Aug 4, 2020):

BTW - I'm running the "textinputdemo.go", and trying to acquire focus in that text box to type something.

<!-- gh-comment-id:668388418 --> @HouzuoGuo commented on GitHub (Aug 4, 2020): BTW - I'm running the "textinputdemo.go", and trying to acquire focus in that text box to type something.
Author
Owner

@mum4k commented on GitHub (Aug 5, 2020):

Hi @HouzuoGuo, thanks for reaching out. The quoted document is actually the design document for termdash, and I am afraid not all part of it were implemented yet. Currently the only way to change the focus is to use a mouse click, this is handled in this library:

https://github.com/mum4k/termdash/blob/master/container/focus.go

We could easily expose a new method on the Container object:

github.com/mum4k/termdash@a8457a77ce/container/container.go (L38-L41)

I.e. a method that moves focus to this container. Then we can assign a specific shortcut to each container to move focus to it. Alternatively if we wanted to change focus using something like arrow keys, we could implement traversal on the tree of containers as requested by pressing an arrow.

<!-- gh-comment-id:668930034 --> @mum4k commented on GitHub (Aug 5, 2020): Hi @HouzuoGuo, thanks for reaching out. The quoted document is actually the design document for termdash, and I am afraid not all part of it were implemented yet. Currently the only way to change the focus is to use a mouse click, this is handled in this library: https://github.com/mum4k/termdash/blob/master/container/focus.go We could easily expose a new method on the Container object: https://github.com/mum4k/termdash/blob/a8457a77ce02c0f0639449f8ff6f876884441839/container/container.go#L38-L41 I.e. a method that moves focus to this container. Then we can assign a specific shortcut to each container to move focus to it. Alternatively if we wanted to change focus using something like arrow keys, we could implement traversal on the tree of containers as requested by pressing an arrow.
Author
Owner

@HouzuoGuo commented on GitHub (Aug 5, 2020):

Many thanks!

<!-- gh-comment-id:668974191 --> @HouzuoGuo commented on GitHub (Aug 5, 2020): Many thanks!
Author
Owner

@fpabl0 commented on GitHub (Nov 16, 2020):

Hi @mum4k any updates on this feature? I want to change focus with Tab key.
BTW, great library! Thanks!

<!-- gh-comment-id:728218740 --> @fpabl0 commented on GitHub (Nov 16, 2020): Hi @mum4k any updates on this feature? I want to change focus with Tab key. BTW, great library! Thanks!
Author
Owner

@mum4k commented on GitHub (Nov 17, 2020):

Hi @fpabl0, I think the current status is that we are looking for an owner who would be willing to pick this up and design and implement this feature. Sorry that I wasn't clear about that in my last update. Are you or @HouzuoGuo interested, or would you prefer if try to find the time?

Once we have the owner, we can discuss on how exactly would this feature work. Another idea that comes to mind is that we could allow the users of termdash to set two keyboard shortcuts. One to move focus forward and one backward. Internally termdash would act on receiving those shortcuts and cycle the focus just between the visible containers (containers that contain widgets (or containers that are the leaf nodes in the binary tree of containers on the terminal).

If one of you is interested in picking this up, I will be happy to help you out by providing code pointers and discussing the approach, etc. Please let me know.

<!-- gh-comment-id:728673045 --> @mum4k commented on GitHub (Nov 17, 2020): Hi @fpabl0, I think the current status is that we are looking for an owner who would be willing to pick this up and design and implement this feature. Sorry that I wasn't clear about that in my last update. Are you or @HouzuoGuo interested, or would you prefer if try to find the time? Once we have the owner, we can discuss on how exactly would this feature work. Another idea that comes to mind is that we could allow the users of termdash to set two keyboard shortcuts. One to move focus forward and one backward. Internally termdash would act on receiving those shortcuts and cycle the focus just between the visible containers (containers that contain widgets (or containers that are the leaf nodes in the binary tree of containers on the terminal). If one of you is interested in picking this up, I will be happy to help you out by providing code pointers and discussing the approach, etc. Please let me know.
Author
Owner

@HouzuoGuo commented on GitHub (Nov 19, 2020):

thanks for your work on this library.. though my calendar looks a bit busy throughout December :|

<!-- gh-comment-id:730156510 --> @HouzuoGuo commented on GitHub (Nov 19, 2020): thanks for your work on this library.. though my calendar looks a bit busy throughout December :|
Author
Owner

@mum4k commented on GitHub (Nov 20, 2020):

Thank you for your response @HouzuoGuo and that is not a problem.

<!-- gh-comment-id:730833421 --> @mum4k commented on GitHub (Nov 20, 2020): Thank you for your response @HouzuoGuo and that is not a problem.
Author
Owner

@mum4k commented on GitHub (Nov 22, 2020):

I have some time in the coming few days, so I can give this a try.

If either of you is interested in testing the feature and giving feedback on it before we release it, please let me know. I can update this issue once I have a working prototype.

<!-- gh-comment-id:731686344 --> @mum4k commented on GitHub (Nov 22, 2020): I have some time in the coming few days, so I can give this a try. If either of you is interested in testing the feature and giving feedback on it before we release it, please let me know. I can update this issue once I have a working prototype.
Author
Owner

@HouzuoGuo commented on GitHub (Nov 23, 2020):

Thanks, you've done a great job with this library so far!

There is a rather old linux utility called "dialog" (https://linux.die.net/man/1/dialog), it is sometimes used by OS installers (e.g. debian forked it) and offers a pretty rich set of UI elements similar to those offered by this library. /usr/share/doc/dialog/examples/ has some ready-to-run demos to try out the keyboard interaction.

If it makes sense, would you please consider making the keyboard navigation experience of this library similar to those offered by an existing utility, such as dialog?

<!-- gh-comment-id:732104491 --> @HouzuoGuo commented on GitHub (Nov 23, 2020): Thanks, you've done a great job with this library so far! There is a rather old linux utility called "dialog" (https://linux.die.net/man/1/dialog), it is sometimes used by OS installers (e.g. debian forked it) and offers a pretty rich set of UI elements similar to those offered by this library. `/usr/share/doc/dialog/examples/` has some ready-to-run demos to try out the keyboard interaction. If it makes sense, would you please consider making the keyboard navigation experience of this library similar to those offered by an existing utility, such as dialog?
Author
Owner

@mum4k commented on GitHub (Nov 24, 2020):

Thank you @HouzuoGuo for mentioning dialog. I didn't know about it and it does provide a lot of good inspiration.

The way how keyboard navigation works pretty much aligns with what I had in mind. I will give it a try and update here once we have something ready.

<!-- gh-comment-id:732541654 --> @mum4k commented on GitHub (Nov 24, 2020): Thank you @HouzuoGuo for mentioning `dialog`. I didn't know about it and it does provide a lot of good inspiration. The way how keyboard navigation works pretty much aligns with what I had in mind. I will give it a try and update here once we have something ready.
Author
Owner

@HouzuoGuo commented on GitHub (Nov 24, 2020):

lovely, thanks very much!

<!-- gh-comment-id:732694591 --> @HouzuoGuo commented on GitHub (Nov 24, 2020): lovely, thanks very much!
Author
Owner

@mum4k commented on GitHub (Dec 30, 2020):

This functionality was included in the latest release v0.14.0. The release includes a demo that shows the newly added keyboard navigation:

go run widgets/textinput/formdemo/formdemo.go

formdemo

Feel free to let me know if there are any missing features or issues.

<!-- gh-comment-id:752362188 --> @mum4k commented on GitHub (Dec 30, 2020): This functionality was included in the latest release [v0.14.0](https://github.com/mum4k/termdash/blob/master/CHANGELOG.md). The release includes a demo that shows the newly added keyboard navigation: ```go go run widgets/textinput/formdemo/formdemo.go ``` ![formdemo](https://user-images.githubusercontent.com/5315344/103337241-9d2ced00-4a48-11eb-8009-e84ef895914e.gif) Feel free to let me know if there are any missing features or issues.
Author
Owner

@HouzuoGuo commented on GitHub (Dec 30, 2020):

wonderful & happy new year!

<!-- gh-comment-id:752708482 --> @HouzuoGuo commented on GitHub (Dec 30, 2020): wonderful & happy new year!
Author
Owner

@mum4k commented on GitHub (Dec 31, 2020):

A happy new year to you too. Feel free to reopen this issue in case of any problems with the keyboard navigation feature.

<!-- gh-comment-id:752840455 --> @mum4k commented on GitHub (Dec 31, 2020): A happy new year to you too. Feel free to reopen this issue in case of any problems with the keyboard navigation feature.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/termdash#135
No description provided.