Keep arrow keys in active text fields (#132)
This commit is contained in:
parent
26b5b5d62f
commit
bfbcba7109
2 changed files with 70 additions and 0 deletions
|
|
@ -198,6 +198,40 @@ func _run() -> void:
|
|||
standard_button.get_theme_stylebox("hover") == old_hover_style,
|
||||
"mouse hover styling was not restored after controller use",
|
||||
)
|
||||
var text_entry := LineEdit.new()
|
||||
text_entry.position = Vector2(520.0, 60.0)
|
||||
text_entry.size = Vector2(220.0, 48.0)
|
||||
text_entry.text = "editable text"
|
||||
stage.add_child(text_entry)
|
||||
standard_button.grab_focus()
|
||||
await process_frame
|
||||
presentation.call("_neutralize_current_navigation_focus")
|
||||
text_entry.grab_focus()
|
||||
await process_frame
|
||||
_expect(
|
||||
presentation.get("_neutral_focus_seed") == null,
|
||||
"entering a text field leaves the prior menu focus seed armed",
|
||||
)
|
||||
for keycode: Key in [KEY_LEFT, KEY_RIGHT, KEY_UP, KEY_DOWN]:
|
||||
var arrow_key := InputEventKey.new()
|
||||
arrow_key.keycode = keycode
|
||||
arrow_key.physical_keycode = keycode
|
||||
arrow_key.pressed = true
|
||||
presentation._input(arrow_key)
|
||||
_expect(
|
||||
root.gui_get_focus_owner() == text_entry,
|
||||
"arrow key %s pulled focus out of an active text field" % keycode,
|
||||
)
|
||||
var modified_arrow := InputEventKey.new()
|
||||
modified_arrow.keycode = KEY_LEFT
|
||||
modified_arrow.physical_keycode = KEY_LEFT
|
||||
modified_arrow.shift_pressed = true
|
||||
modified_arrow.pressed = true
|
||||
presentation._input(modified_arrow)
|
||||
_expect(
|
||||
root.gui_get_focus_owner() == text_entry,
|
||||
"a modified arrow pulled focus out of an active text field",
|
||||
)
|
||||
var item_list := ItemList.new()
|
||||
item_list.position = Vector2(80.0, 160.0)
|
||||
item_list.size = Vector2(240.0, 150.0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue