Repository: godotengine/godot (language: cpp)

Issue:
Can't cycle Buttons in "Attach Node Script'' panel with Tab/Shift+Tab
### Tested versions

- Reproduceable in Godot v4.3.stable (77dcf97d8)

### System information

Godot v4.3.stable (77dcf97d8) - Windows 10.0.26100 - Vulkan (Mobile) - dedicated NVIDIA GeForce GTX 1080 Ti (NVIDIA; 32.0.15.6109) - AMD Ryzen 5 3600 6-Core Processor (12 Threads)

### Issue description

When creating a new script on the "Attach Node Script" panel if we press tab we can select all other widgets except for "Create" and "Cancel" buttons. 

![Image](https://github.com/user-attachments/assets/12217652-8021-493f-99c8-cfd36789f45f)

### Steps to reproduce

1- Create a node (any kind)
2- Add a New Script
3- Notice we can't use Tab to select any of the buttons, only the rest of the properties.

### Minimal reproduction project (MRP)

N/A


Discussion / hints:

Fix patch:
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index d09ce9d72207..a79ba285e9ad 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -467,7 +467,7 @@ AcceptDialog::AcceptDialog() {
 	message_label->set_anchor(SIDE_BOTTOM, Control::ANCHOR_END);
 	add_child(message_label, false, INTERNAL_MODE_FRONT);
 
-	add_child(buttons_hbox, false, INTERNAL_MODE_FRONT);
+	add_child(buttons_hbox, false, INTERNAL_MODE_BACK);
 
 	buttons_hbox->add_spacer();
 	ok_button = memnew(Button);


Test patch:
diff --git a/tests/scene/test_control.h b/tests/scene/test_control.h
index df498b94194f..f442126d30e6 100644
--- a/tests/scene/test_control.h
+++ b/tests/scene/test_control.h
@@ -162,7 +162,54 @@ TEST_CASE("[SceneTree][Control] Find next/prev valid focus") {
 			CHECK_UNARY(ctrl->has_focus());
 		}
 
-		SUBCASE("[SceneTree][Control] Has a sibling control but the parent node is not a control") {
+		SUBCASE("[SceneTree][Control] Has a sibling control and the parent is a window") {
+			Control *ctrl1 = memnew(Control);
+			Control *ctrl2 = memnew(Control);
+			Control *ctrl3 = memnew(Control);
+			Window *win = SceneTree::get_singleton()->get_root();
+
+			ctrl1->set_focus_mode(Control::FocusMode::FOCUS_ALL);
+			ctrl2->set_focus_mode(Control::FocusMode::FOCUS_ALL);
+			ctrl3->set_focus_mode(Control::FocusMode::FOCUS_ALL);
+
+			ctrl2->add_child(ctrl3);
+			win->add_child(ctrl1);
+			win->add_child(ctrl2);
+
+			SUBCASE("[SceneTree][Control] Focus Next") {
+				ctrl1->grab_focus();
+				CHECK_UNARY(ctrl1->has_focus());
+
+				SEND_GUI_ACTION("ui_focus_next");
+				CHECK_UNARY(ctrl2->has_focus());
+
+				SEND_GUI_ACTION("ui_focus_next");
+				CHECK_UNARY(ctrl3->has_focus());
+
+				SEND_GUI_ACTION("ui_focus_next");
+				CHECK_UNARY(ctrl1->has_focus());
+			}
+
+			SUBCASE("[SceneTree][Control] Focus Prev") {
+				ctrl1->grab_focus();
+				CHECK_UNARY(ctrl1->has_focus());
+
+				SEND_GUI_ACTION("ui_focus_prev");
+				CHECK_UNARY(ctrl3->has_focus());
+
+				SEND_GUI_ACTION("ui_focus_prev");
+				CHECK_UNARY(ctrl2->has_focus());
+
+				SEND_GUI_ACTION("ui_focus_prev");
+				CHECK_UNARY(ctrl1->has_focus());
+			}
+
+			memdelete(ctrl3);
+			memdelete(ctrl1);
+			memdelete(ctrl2);
+		}
+
+		SUBCASE("[SceneTree][Control] Has a sibling control but the parent node is not a control or window") {
 			Control *other_ctrl = memnew(Control);
 			intermediate->add_child(other_ctrl);