Repository: godotengine/godot (language: cpp)

Issue:
Inspecting an exported typed dictionary while editing a script grabs the focus away from the script editor
### Tested versions

4.4.dev2

### System information

Windows 11 - Godot 4.4.dev2 - Vulkan(Forward+)

### Issue description

If you have typed dictionary open in the inspector (so you can edit the values), it will grab the focus away from script editor everytime it has done checking for errors.

[Here's a video I am experiencing](https://youtu.be/kqKLc6nGcPo)

### Steps to reproduce

1. Create a script with export variable that is any kind of typed dictionary.
2. Attach it to a node and click the node so you can see the exported typed dictionary.
3. In inspector, open the dictionary so the keys and values are shown in the inspector.
4. Edit script in the script editor in any way and wait for the script editor to check for errors.
5. The typed dictionary's "New Value" should grab the focus away from the script editor.
This is very noticeable if you change the "text_editor/completion/idle_parse_delay" in EditorSettings to a very low value.

### Minimal reproduction project (MRP)

[dictionary_issue.zip](https://github.com/user-attachments/files/16980287/dictionary_issue.zip)


Discussion / hints:
Haven't confirmed but should be caused by this code:
https://github.com/godotengine/godot/blob/83d54ab2ad476ae265b323c2b88f4623b922f4c6/editor/editor_properties_array_dict.cpp#L1178-L1183

But can't see how it is affected specifically by typed dictionaries, but confirmed that non-typed dictionaries won't trigger this

CC @Repiteo 
@AThousandShips I found that `grab_focus` skips focusing with an early return, but only for non-typed arrays. I believe it has to do with the default value that only appears for typed ones, e.g. 0 for int values.

Do you mind if I try fixing this?
I was about to open an issue but I've seen this one.
Also happens when **saving the script** containing the exposed variable, and when **saving the whole project** as well.

https://github.com/user-attachments/assets/1bbfe41b-db9a-44ec-b02d-ae1ab2d25625

I don't know whether the proposed fix solves this issue.

Fix patch:
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index 6d56a3f2541b..6442a04f2a37 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -1287,7 +1287,7 @@ EditorPropertyDictionary::EditorPropertyDictionary() {
 	change_type = memnew(PopupMenu);
 	add_child(change_type);
 	change_type->connect(SceneStringName(id_pressed), callable_mp(this, &EditorPropertyDictionary::_change_type_menu));
-	changing_type_index = -1;
+	changing_type_index = EditorPropertyDictionaryObject::NOT_CHANGING_TYPE;
 	has_borders = true;
 
 	key_subtype = Variant::NIL;


Test patch: