From 45c44352ba82fdc48cd6639a3b31b54e3ec51ec0 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Sat, 21 Sep 2019 09:19:00 -0500 Subject: [PATCH] Fixes: * It was the mouse warping, not the grabbing of focus, that caused keyboard traversal issues. Now we only mouse-warp prior to simulating a right-click via Menu. * Despite what the docs say, `id_focused` seems to pass an index, not an ID. Now popup menu items speak more accurately. --- accessible.gd | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/accessible.gd b/accessible.gd index 3efe4da..d9aed88 100644 --- a/accessible.gd +++ b/accessible.gd @@ -174,12 +174,8 @@ func panel_focus(): func popup_menu_focus(): tts.speak("menu", false) -func popup_menu_item_id_focus(id): +func popup_menu_item_id_focus(index): var tokens = PoolStringArray([]) - var index = node.get_item_index(id) - print("id: %s, index: %s" % [id, index]) - if index == -1: - index = id var item = node.get_item_text(index) if item: tokens.append(item) @@ -201,7 +197,7 @@ func popup_menu_item_id_focus(id): var text = shortcut.get_as_text() if text != "None": tokens.append(text) - tokens.append(str(id + 1) + " of " + str(node.get_item_count())) + tokens.append(str(index + 1) + " of " + str(node.get_item_count())) tts.speak(tokens.join(": "), true) func tree_item_render(): @@ -355,7 +351,6 @@ func tab_container_input(event): func focus(): print("Focus: %s" % node) - node.get_tree().root.warp_mouse(node.rect_global_position) tts.stop() var label = guess_label() if label: @@ -400,12 +395,12 @@ func unfocus(): func click_focus(): if node.has_focus(): return - # print("Grabbing focus: %s" % node) - # node.grab_focus() - focus() + print("Grabbing focus: %s" % node) + node.grab_focus() func gui_input(event): if event is InputEventKey and event.pressed and not event.echo and event.scancode == KEY_MENU: + node.get_tree().root.warp_mouse(node.rect_global_position) return click(null, BUTTON_RIGHT) if node is TabContainer: return tab_container_input(event)