mirror of
https://github.com/lightsoutgames/godot-accessibility.git
synced 2024-11-21 11:35:56 +00:00
Allow a global override to determine if the next focus event should interrupt speech.
There seem to be a small handful of cases where we want this--controls that gain focus immediately after a dialog appears, for instance. We allow these edge cases to indicate that the next focus shouldn't stop speech, then clear it on cases where speech isn't stopped. This is a bit hacky, but seems cleaner than anything else I came up with.
This commit is contained in:
parent
c218d18090
commit
54c01c5381
|
@ -54,7 +54,7 @@ func _guess_label():
|
||||||
|
|
||||||
func _accept_dialog_speak():
|
func _accept_dialog_speak():
|
||||||
if node.dialog_text != "":
|
if node.dialog_text != "":
|
||||||
TTS.speak("dialog: %s" % node.dialog_text)
|
TTS.speak("dialog: %s" % node.dialog_text, false)
|
||||||
|
|
||||||
|
|
||||||
func accept_dialog_focused():
|
func accept_dialog_focused():
|
||||||
|
@ -66,6 +66,7 @@ func accept_dialog_focused():
|
||||||
|
|
||||||
func _accept_dialog_about_to_show():
|
func _accept_dialog_about_to_show():
|
||||||
_accept_dialog_speak()
|
_accept_dialog_speak()
|
||||||
|
ScreenReader.should_stop_on_focus = false
|
||||||
|
|
||||||
|
|
||||||
func checkbox_focused():
|
func checkbox_focused():
|
||||||
|
@ -543,7 +544,9 @@ func tab_container_input(event):
|
||||||
|
|
||||||
func focused():
|
func focused():
|
||||||
print_debug("Focus: %s" % node)
|
print_debug("Focus: %s" % node)
|
||||||
|
if ScreenReader.should_stop_on_focus:
|
||||||
TTS.stop()
|
TTS.stop()
|
||||||
|
ScreenReader.should_stop_on_focus = true
|
||||||
if not node is Label:
|
if not node is Label:
|
||||||
var label = _guess_label()
|
var label = _guess_label()
|
||||||
if label:
|
if label:
|
||||||
|
|
|
@ -21,6 +21,7 @@ export var explore_by_touch_interval = 200
|
||||||
|
|
||||||
export var enable_focus_mode = false
|
export var enable_focus_mode = false
|
||||||
|
|
||||||
|
var should_stop_on_focus = true
|
||||||
|
|
||||||
func _set_enabled(v):
|
func _set_enabled(v):
|
||||||
if enabled:
|
if enabled:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user