Focus and dialog presentation tweaks.

* Remove indiscriminant speech stop on focus events.
* Only stop speech on input events that are keypresses.
* Don't interrupt speech when a dialog is presented.

Now dialogs present in their entirety without having their labels explicitly focused. This allows for Godot's default behavior, where the _OK_ button is automatically focused when the dialog appears, to speak the dialog text and the button as a screen reader user would expect.
This commit is contained in:
Nolan Darilek 2020-08-10 12:12:12 -05:00
parent 6beeaa01bd
commit c459a35f0d

View File

@ -54,7 +54,8 @@ func _guess_label():
func _accept_dialog_speak():
if node.dialog_text != "":
TTS.speak("dialog: %s" % node.dialog_text)
print("Speaking %s" % node.dialog_text)
TTS.speak("dialog: %s" % node.dialog_text, false)
func accept_dialog_focused():
@ -65,6 +66,7 @@ func accept_dialog_focused():
func _accept_dialog_about_to_show():
print("About to show")
_accept_dialog_speak()
@ -543,7 +545,6 @@ func tab_container_input(event):
func focused():
print_debug("Focus: %s" % node)
TTS.stop()
if not node is Label:
var label = _guess_label()
if label:
@ -605,6 +606,8 @@ func click_focused():
func gui_input(event):
if event is InputEventKey and event.pressed:
TTS.stop()
if (
event is InputEventKey
and Input.is_action_just_pressed("ui_accept")