mirror of
https://github.com/lightsoutgames/godot-accessibility.git
synced 2024-11-22 11:55:56 +00:00
Add group navigation.
Moving through every focusable widget by tab/shift-tab is very slow. This commit introduces the concept of groups--widgets that can be skipped through via ctrl-tab/ctrl-shift-tab. Right now this only includes containers where all children are focusable, but I'll expand the definition of groups over time to make navingating to large areas of the UI easier..
This commit is contained in:
parent
49d6eb8e59
commit
cafd50675b
|
@ -386,6 +386,8 @@ func focus():
|
||||||
print("No handler")
|
print("No handler")
|
||||||
if node.hint_tooltip and not spoke_hint_tooltip:
|
if node.hint_tooltip and not spoke_hint_tooltip:
|
||||||
tts.speak(node.hint_tooltip, false)
|
tts.speak(node.hint_tooltip, false)
|
||||||
|
if is_in_group():
|
||||||
|
tts.speak("group", false)
|
||||||
spoke_hint_tooltip = false
|
spoke_hint_tooltip = false
|
||||||
|
|
||||||
func unfocus():
|
func unfocus():
|
||||||
|
@ -425,8 +427,21 @@ func gui_input(event):
|
||||||
return node.accept_event()
|
return node.accept_event()
|
||||||
elif event.is_action_pressed("ui_down"):
|
elif event.is_action_pressed("ui_down"):
|
||||||
return node.accept_event()
|
return node.accept_event()
|
||||||
|
elif event is InputEventWithModifiers:
|
||||||
|
if Input.is_action_just_pressed("ui_focus_prev") and event.control and is_in_group():
|
||||||
|
print("Prev")
|
||||||
|
var target = get_siblings()[0]
|
||||||
|
if target:
|
||||||
|
print("Got target")
|
||||||
|
target.grab_focus()
|
||||||
|
target.grab_click_focus()
|
||||||
|
elif Input.is_action_just_pressed("ui_focus_next") and event.control and is_in_group():
|
||||||
|
var target = get_siblings()[-1]
|
||||||
|
if target:
|
||||||
|
target.grab_focus()
|
||||||
|
target.grab_click_focus()
|
||||||
|
|
||||||
func is_in_bar():
|
func is_in_group():
|
||||||
var parent = node.get_parent()
|
var parent = node.get_parent()
|
||||||
if parent and parent is Container:
|
if parent and parent is Container:
|
||||||
for child in parent.get_children():
|
for child in parent.get_children():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user