Skip to content

Commit 107e527

Browse files
committed
Review focus issues with controller and screen reader
1 parent db7166a commit 107e527

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

scenes/config/AboutSettings.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func grab_focus():
2929
if RetroHubConfig.config.accessibility_screen_reader_enabled:
3030
match n_tabs.current_tab:
3131
0: # About RetroHub
32-
n_logo.grab_focus()
32+
n_version.grab_focus()
3333
1: # Libraries
3434
n_libraries_intro_lbl.grab_focus()
3535
2: # Assets
@@ -64,5 +64,5 @@ func _on_OpenIssuesButton_pressed():
6464

6565
func _on_TabContainerHandler_tab_changed(_tab_container, enter_tab):
6666
if enter_tab:
67-
grab_focus()
67+
self.grab_focus()
6868

scenes/config/AboutSettings.tscn

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ expand_mode = 1
7474
stretch_mode = 5
7575
script = ExtResource("10")
7676

77-
[node name="AccessibilityFocus" type="Node" parent="TabContainerHandler/TabContainer/About/VBoxContainer/HBoxContainer/Logo"]
78-
script = ExtResource("18")
79-
8077
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainerHandler/TabContainer/About/VBoxContainer/HBoxContainer"]
8178
layout_mode = 2
8279
size_flags_horizontal = 3
@@ -107,12 +104,12 @@ size_flags_horizontal = 8
107104
[node name="OpenWebsiteButton" type="Button" parent="TabContainerHandler/TabContainer/About/VBoxContainer/HBoxContainer/HFlowContainer"]
108105
unique_name_in_owner = true
109106
layout_mode = 2
110-
focus_neighbor_top = NodePath("../OpenIssuesButton")
107+
focus_neighbor_top = NodePath("../../../../../..")
111108
text = "Open project website"
112109

113110
[node name="OpenIssuesButton" type="Button" parent="TabContainerHandler/TabContainer/About/VBoxContainer/HBoxContainer/HFlowContainer"]
114111
layout_mode = 2
115-
focus_neighbor_bottom = NodePath("../OpenWebsiteButton")
112+
focus_neighbor_bottom = NodePath("../../../../../..")
116113
text = "Report issues"
117114

118115
[node name="HSeparator" type="HSeparator" parent="TabContainerHandler/TabContainer/About/VBoxContainer"]
@@ -156,6 +153,7 @@ script = ExtResource("9")
156153
[node name="Libraries" type="ScrollContainer" parent="TabContainerHandler/TabContainer"]
157154
visible = false
158155
layout_mode = 2
156+
follow_focus = true
159157

160158
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainerHandler/TabContainer/Libraries"]
161159
layout_mode = 2
@@ -508,6 +506,7 @@ script = ExtResource("9")
508506
[node name="Assets" type="ScrollContainer" parent="TabContainerHandler/TabContainer"]
509507
visible = false
510508
layout_mode = 2
509+
follow_focus = true
511510

512511
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainerHandler/TabContainer/Assets"]
513512
layout_mode = 2
@@ -699,6 +698,8 @@ anchor_bottom = 1.0
699698
unique_name_in_owner = true
700699
custom_minimum_size = Vector2(200, 0)
701700
layout_mode = 2
701+
focus_neighbor_top = NodePath("../../../..")
702+
focus_neighbor_bottom = NodePath("../../../..")
702703
hide_root = true
703704

704705
[node name="AccessibilityFocus" type="Node" parent="TabContainerHandler/TabContainer/Licenses/HBoxContainer/Names"]

scenes/config/settings/InputSettings.tscn

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ size_flags_horizontal = 3
8383
size_flags_vertical = 3
8484

8585
[node name="Keyboard" type="VBoxContainer" parent="ScrollContainer/VBoxContainer/TabContainerHandler/InputTab"]
86+
visible = false
8687
layout_mode = 2
8788
size_flags_horizontal = 3
8889
size_flags_vertical = 3
@@ -747,7 +748,6 @@ script = ExtResource("44")
747748
next = NodePath("../../../../../../..")
748749

749750
[node name="Virtual Keyboard" type="VBoxContainer" parent="ScrollContainer/VBoxContainer/TabContainerHandler/InputTab"]
750-
visible = false
751751
layout_mode = 2
752752
size_flags_horizontal = 3
753753
size_flags_vertical = 3
@@ -826,6 +826,10 @@ layout_mode = 2
826826
focus_neighbor_bottom = NodePath("../../../../..")
827827
text = "On Mouse Click/Touch"
828828

829+
[node name="AccessibilityFocus" type="Node" parent="ScrollContainer/VBoxContainer/TabContainerHandler/InputTab/Virtual Keyboard/HBoxContainer2/VBoxContainer/VirtualKeyboardOnMouse"]
830+
script = ExtResource("44")
831+
next = NodePath("../../../../../..")
832+
829833
[node name="ControllerSlideLeft" type="TextureRect" parent="ScrollContainer/VBoxContainer/TabContainerHandler"]
830834
custom_minimum_size = Vector2(30, 30)
831835
layout_mode = 0

source/utils/TabContainerHandler.gd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ func _input(event):
5858
event.is_action_pressed("rh_accept")):
5959
get_viewport().set_input_as_handled()
6060
handle_focus(true)
61+
elif _focused and event.is_action_pressed("ui_up"):
62+
get_viewport().set_input_as_handled()
6163

6264
func is_key_event_on_text(event: InputEvent):
6365
if event is InputEventKey:
@@ -70,6 +72,7 @@ func _on_tab_clicked(_tab_idx: int):
7072

7173
func handle_focus(enter_tab: bool):
7274
RetroHubUI.play_sound(RetroHubUI.AudioKeys.SLIDE)
75+
await get_tree().process_frame
7376
if signal_tab_change:
7477
emit_signal("tab_changed", tab, enter_tab)
7578
elif enter_tab and tab.get_current_tab_control().focus_mode != FOCUS_NONE:

0 commit comments

Comments
 (0)