-
Notifications
You must be signed in to change notification settings - Fork 35
feat(tabwidget): keyboard accessibility highlight #534
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
base: main
Are you sure you want to change the base?
feat(tabwidget): keyboard accessibility highlight #534
Conversation
|
this is nice, |
|
Unfortunately I need to refactor the way the theme is propagated to the child components, |
|
It is not unfortunate that the theme handling needs to be refactored because, frankly, anything shall be better than the way things have had to be implemented at this stage, so I am glad you are already willing to upgrade it for something completely different. You should not really view the current classStyle workarounds a problem, but rather a natural progression in development of this widget which is turning out to be really good I think one of the best implementations of proper tabs in a TUI that I have ever seen. So you should be pleased with your work on it so far, albeit there is much potential for refinement to improve it even more.
This is where some confusion may have arisen since "focus" in this context has an abstract meaning here due to multiple button sub-widgets on the overall tab bar itself. For this reason I have elected to abolish the "focus" classStyle in favour of the "selected" terminology instead in this PR to help us differentiate between the current tab and whichever auxiliary the keyboard focus is on (because this is also not the same as those widgets which need to be "highlighted" to help with the keyboard focus navigation/accessibility). In other words, I think the meaning of "focus" should be used only to represent the main outer widget that has keyboard control (i.e. the entire TabBar widget in this case) and I consider that the tab buttons are mearly "highlighted" while navigating left/right. With some careful thought and planning of your intended focus proxy system I am confident we can make it work and look the way you would like. If you find my feedback helps you figure this out then please feel free to ask me about your ideas or if you get stuck on something while deciding on a module design that works the best because workable theming is very important not only for visual appearance but also, perhaps even more importantly, for the logical functionality of accessible keyboard navigation too. I am looking forward to testing your future development on this. I don't personally mind if you need to make breaking changes in the main branch, then I'd say just go for it, or let us know if you make development branch for testing. |
|
The core routine need to be rewritten and it require some time of proper planning, I am expecting the implementation to be straightforward after this and I think there will not be breaking changes. Right now the focussed widget is only one and in the current design it receive all the keypresses, unless the keypress event return False, so the control goes back to root that decide to handle it (i.e. focus the next widget) or do nothing. At the moment In order to let the parent to handle special keys (i.e. tab), The theme trickery I mentioned was not the classStyle itself but the mergeStyle method that is quite abused and force the use of shortcuts and workarounds. I am thinking to introduce the concept of focus proxy or focus orchestrators where, in the case of the tab widget, the tab widget get the focus from the root, and inside domain of the tab focus proxy, the tab button receive the focus, any unhandled keypresses (i.e. direction keys), instead of going back to root, will be handled by the tab widget (i.e. to switch between tabs) |
|
What advantages would be offered by the implementing a library-wide focus proxy to orchestrate which widget or sub-widget the keyboard controls, over and above implementations of custom written methods specific to each widget? What are the reasons why the existing implementation can't be evolved and refined to provide the desired functionality? |
|
the advantage is to have a proxy that can be customised to change the focus logic, |
|
I see thank you for clariying. Yes I agree it would be better in many cases if the focus handler was more easily available in the parent container widget instead of being trapped inside a sub-widget. |

This PR enables keyboard accessibility for the
TTkTabButtonwidgets of aTTkTabBarwidget because otherwise currently its nearly impossible to see while navigating across the buttons while everything has the same white borders...Start of navigation (key tab onto it) all the tabs are highlighted at first so there is no doubt which widget has got the focus:

During keyboard navigation (left and right keys) it can be clearly seen in yellow which button is being highlighted:

At the end the offset indicator arrow stops blinking and turns grey to let you know the end is reached:

The NERD tabs now also support keyboard navigation too:

Implementation with slightly darker borders shows higher contrast of the selection to clearly see which mode the program is in as well as the keyboard navigation currently highlighted in bold yellow makes it easy to use even without mouse:
