Improve focus interactions of GUI filters and mod list #2827
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problems
If you open GUI and press ctrl-F, focus goes to the filter boxes. To get back to the mod list, you have to press tab twelve times, cycling through many other controls first. This is a detriment to keyboard usability.
While you're editing the filters, it's not easy to tell that the mod list doesn't have focus. There's a small blinking cursor in the text box, but meanwhile the mod list has its big active-looking row highlight. Then when you tab to the mod list, nothing about its appearance changes, so you can't tell that you've made it there. Other WinForms controls commonly gray out their selection highlight when inactive.
If you focus the mod list and press tab or shift-tab, it goes into this weird mode where you are tabbing through individual cells and the row highlight goes away. This isn't how that control is intended to work in CKAN.
Causes
The
TabIndex
properties inMain.Designer.cs
are pretty scrambled, so focus jumps around when tabbing:Old tab order list
The
DataGridView
doesn't seem to haveInactiveHighlight
color properties, so it uses the default highlight colors all the time.ModList.StandardTab
isn't set.Changes
Now the tab order is re-done to match the order of the controls in the window. The mod list immediately follows the filters, so from the name filter you can press tab 3 times to focus it (since you have to go through the other filters, which we may streamline when addressing #2736). The
InstallAllCheckbox
is assigned a spot in the tab order but will be skipped viaTabStop=false
because it does not display any focus cues when focused (CheckBox
puts a dotted line around the text, of which this control has none); if we can figure out how to put a dotted line around it, it may make sense to re-enable tabstop, or it may be better to keep this as a mouse-only control since it would increase the number of tabs to get from the filters to the mod list.In addition, if you are in a filter text box and you press enter or down arrow or page down, the focus goes to the mod list. This provides an easier shortcut than tabbing if you're in the name control.
Now when the mod list is not focused, its row highlight color is changed to the system control (default gray). When focus returns to the mod list, the row highlight changes back to the system highlight (default blue). This makes it easier to tell where the focus is when working with the filter text boxes, and provides visual feedback when the mod list receives focus:
Now the weird cell-tabbing behavior is turned off. Pressing tab or shift-tab when the mod list has focus will move focus to the next or previous controls, as normal. This makes it easier to reach the filters via shift-tab.
Fixes #2826. Note that this issue requests automatic focus changing after pasting from the clipboard. I don't think we can hook into clipboard pasting, but now you can press enter after pasting to focus the mod list.
Note that a "paste and go" option is common in browsers now, so maybe we could add something like that when we address #2736: