mirror of
https://github.com/lightsoutgames/godot-accessibility.git
synced 2024-11-22 11:55:56 +00:00
Better label-guessing logic, and make associated labels non-focusable.
This commit is contained in:
parent
14e1832803
commit
8f53556129
|
@ -36,6 +36,9 @@ func guess_label():
|
||||||
var label = tokens.join(": ")
|
var label = tokens.join(": ")
|
||||||
if label:
|
if label:
|
||||||
return label
|
return label
|
||||||
|
for child in to_check.get_children():
|
||||||
|
if child is Label:
|
||||||
|
return child
|
||||||
to_check = to_check.get_parent()
|
to_check = to_check.get_parent()
|
||||||
|
|
||||||
func accept_dialog_focused():
|
func accept_dialog_focused():
|
||||||
|
@ -449,6 +452,8 @@ func focused():
|
||||||
TTS.stop()
|
TTS.stop()
|
||||||
var label = guess_label()
|
var label = guess_label()
|
||||||
if label:
|
if label:
|
||||||
|
if label is Label:
|
||||||
|
label = label.text
|
||||||
TTS.speak(label, false)
|
TTS.speak(label, false)
|
||||||
if node is MenuButton:
|
if node is MenuButton:
|
||||||
menu_button_focused()
|
menu_button_focused()
|
||||||
|
@ -592,6 +597,9 @@ func _init(node):
|
||||||
self.node = node
|
self.node = node
|
||||||
if is_focusable(node):
|
if is_focusable(node):
|
||||||
node.set_focus_mode(Control.FOCUS_ALL)
|
node.set_focus_mode(Control.FOCUS_ALL)
|
||||||
|
var label = guess_label()
|
||||||
|
if label is Label:
|
||||||
|
label.set_focus_mode(Control.FOCUS_NONE)
|
||||||
node.connect("focus_entered", self, "focused")
|
node.connect("focus_entered", self, "focused")
|
||||||
node.connect("mouse_entered", self, "click_focused")
|
node.connect("mouse_entered", self, "click_focused")
|
||||||
node.connect("focus_exited", self, "unfocused")
|
node.connect("focus_exited", self, "unfocused")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user