summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor/editor_file_dialog.cpp3
-rw-r--r--scene/gui/file_dialog.cpp4
2 files changed, 7 insertions, 0 deletions
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 02a9cc905b..288874d36b 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -703,6 +703,9 @@ void EditorFileDialog::update_file_list() {
item_list->clear();
+ // Scroll back to the top after opening a directory
+ item_list->get_v_scroll()->set_value(0);
+
if (display_mode == DISPLAY_THUMBNAILS) {
item_list->set_max_columns(0);
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 5cb4bcc64f..08e943fa8c 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -413,6 +413,10 @@ void FileDialog::update_file_name() {
void FileDialog::update_file_list() {
tree->clear();
+
+ // Scroll back to the top after opening a directory
+ tree->get_vscroll_bar()->set_value(0);
+
dir_access->list_dir_begin();
TreeItem *root = tree->create_item();