Add wrapping keyboard and gamepad focus rings
- Link every modal's enabled controls into a wrapping UiFocus ring and give each screen a default focus target. - Add gamepad A/B bindings for ui_accept/ui_cancel; include Start menu footer actions and Continue in its focus ring. - Skip hidden/disabled controls, close focus traps via per-modal cancel behavior, and return review to the menu on cancel. - Record the focus audit and add regression coverage.
This commit is contained in:
1 parent
9692f262f1
commit
8f65751975
17 files changed
+262
-76
No files matched your search
@@ -4,6 +4,7 @@ extends RefCounted
|
||||
## theme when a control is focused or disabled.
|
||||
|
||||
const UiStyles := preload("res://src/game/ui/ui_styles.gd")
|
||||
const UiFocus := preload("res://src/game/ui/ui_focus.gd")
|
||||
|
||||
func test_shared_button_states_are_complete() -> bool:
|
||||
var button := Button.new()
|
||||
@@ -24,3 +25,16 @@ func test_shared_button_states_are_complete() -> bool:
|
||||
"the disabled state is visually distinct from normal")
|
||||
button.free()
|
||||
return a and b and c
|
||||
|
||||
func test_focus_helper_skips_hidden_and_disabled_controls() -> bool:
|
||||
var hidden := Button.new()
|
||||
hidden.visible = false
|
||||
var disabled := Button.new()
|
||||
disabled.disabled = true
|
||||
var normal := Button.new()
|
||||
var first := UiFocus.first_enabled([hidden, disabled, normal])
|
||||
var a := TestUtils.check_eq(first, normal, "focus skips hidden and disabled controls")
|
||||
hidden.free()
|
||||
disabled.free()
|
||||
normal.free()
|
||||
return a
|
||||
Reference in new issue
Block a user