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

Improve focus interactions of GUI filters and mod list #2827

Merged
merged 1 commit into from
Jul 6, 2019

Conversation

HebaruSan
Copy link
Member

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.

image

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.

image

Causes

The TabIndex properties in Main.Designer.cs are pretty scrambled, so focus jumps around when tabbing:

Old tab order list
0	menustrip1
0	modinfotabcontrol
0	managemodstabpage

1	waittabpage
1	statustrip1
2	menustrip2
2	changesettabpage
3	chooserecommendedmodstabpage
3	modlist
4	changeslistview
4	chooseprovidedmodstabpage
5	confirmchangesbutton
5	recommendedmodslistview

6	cancelchangesbutton
6	messagetextbox
6	recommendeddialoglabel

7	splitcontainer1
7	dialogprogressbar
7	recommendedmodscontinuebutton
7	chooseprovidedmodslabel

8	retrycurrentactionbutton
8	logtextbox
8	recommendedmodscancelbutton
8	chooseprovidedmodslistview

9	maintabcontrol
9	cancelcurrentactionbutton
9	recommendedmodstogglecheckbox
9	chooseprovidedmodscontinuebutton

10	chooseprovidedmodscancelbutton
10	filterbynamelabel
11	filterbynametextbox
12	filterbyauthorlabel
13	filterbyauthortextbox
14	filterbydescriptionlabel
15	filterbydescriptiontextbox

The DataGridView doesn't seem to have InactiveHighlight 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 via TabStop=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:

image

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:

image

@HebaruSan HebaruSan added Bug Easy This is easy to fix GUI Issues affecting the interactive GUI Pull request Enhancement labels Jul 5, 2019
Copy link
Member

@Olympic1 Olympic1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine for me.

@Olympic1 Olympic1 merged commit 6eeed83 into KSP-CKAN:master Jul 6, 2019
@HebaruSan HebaruSan deleted the fix/gui-filter-tab-order branch July 6, 2019 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Easy This is easy to fix Enhancement GUI Issues affecting the interactive GUI Pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Automatically switch to the modification list after inserting text into the filter
2 participants