From c459a35f0d4490934b9245d53b991c6a0f9462dd Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Mon, 10 Aug 2020 12:12:12 -0500 Subject: [PATCH] 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. --- Accessible.gd | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Accessible.gd b/Accessible.gd index 12eb1f7..838a108 100644 --- a/Accessible.gd +++ b/Accessible.gd @@ -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")