Feature/sidebar focus#1719
Conversation
Allows users to move keyboard focus directly to the projects sidebar using <Control><Alt>Left, improving accessibility and full keyboard navigation.
jeremypw
left a comment
There was a problem hiding this comment.
Unfortunately this does not seem to work yet - focus remains with the document for me. Not sure why yet, but it does work if you focus the choose_project_button instead. So its something to do with making sure the treeview within the SourceList gets (and retains) the final focus.
Also may need a matching hotkey to return focus to the document but that can be addressed later.
I notice that if you do focus the choose_project_button then you can reach other widgets in the headerbar by using the standard Tab and <Shift>Tab keys. But not the actionbar.
| construct { | ||
| orientation = Gtk.Orientation.VERTICAL; | ||
| get_style_context ().add_class (Gtk.STYLE_CLASS_SIDEBAR); | ||
| can_focus = true; |
There was a problem hiding this comment.
I am not sure this right - Sidebar is a container (Grid) which cannot have keyboard focus itself
0916dbb to
9f37b0e
Compare
|
@jeremypw Thanks for the detailed review and for pointing out the root cause! You are completely right. I have addressed the requested changes:-.
Regarding the shortcut to return focus to the document and the Actionbar tab navigation, I agree that those can be addressed in a separate follow-up PR as enhancements Thanks again! |
|
@Dipanshusinghh Still not working for me I am afraid. It is possible to make the sourcelist have keyboard focus by starting and then cancelling a rename operation on one of the items. After that you can move the cursor up and down with the keyboard. However, then pressing the |
jeremypw
left a comment
There was a problem hiding this comment.
A have made a couple of suggestions that should get this working (as long as there is a selected item in the sidebar at least.
| @@ -2937,5 +2937,9 @@ public class SourceList : Gtk.ScrolledWindow { | |||
|
|
|||
| return null; | |||
| } | |||
|
|
|||
| public override void grab_focus () { | |||
There was a problem hiding this comment.
This needs to be public new void grab_focus ()
|
|
||
| public void focus_sidebar () { | ||
| if (stack.visible_child != null) { | ||
| stack.visible_child.grab_focus (); |
There was a problem hiding this comment.
You need to check the visible child is a SourceList and then cast it to that type in order to ensure the modified grab_focus method works as expected.
9f37b0e to
3f704fe
Compare
|
@jeremypw I have updated the PR with the exact changes you suggested
Tested and verified. Thanks again for the excellent guidance and help in getting this right |
jeremypw
left a comment
There was a problem hiding this comment.
This works as expected now - thanks! I think we ought to implement the reverse action in this PR though on second thoughts.
There are some other issues with keyboard focus control - in particular switching from doc to terminal and back but they can wait.
I notice that once you are out of the doc/terminal focus pair, other widgets can be reached with the standard Tab/Shift-Tab keys, so that's good.
|
You need to merge in the updated master branch - I cannot do that. |
…entary#1711) Binds <Control><Alt>Right to action-focus-document, allowing users to return keyboard focus from the project sidebar back to the active text document as requested by maintainer.
|
@jeremypw I have updated the PR as requested:
|
Summary
This PR fixes the keyboard accessibility issue where the project sidebar could not be focused via keyboard navigation.
Changes Made
Code.Sidebarfocusable by settingcan_focus = true.ACTION_FOCUS_SIDEBAR(action-focus-sidebar) toMainWindow.<Control><Alt>Leftto focus the sidebar directly (and opens it automatically if it is currently hidden).Fixes #1711