@@ -142,7 +142,8 @@ void ProjectListItemControl::_notification(int p_what) {
142142 if (is_hovering) {
143143 draw_style_box (get_theme_stylebox (SNAME (" hovered" ), SNAME (" Tree" )), Rect2 (Point2 (), get_size ()));
144144 }
145- if (has_focus ()) {
145+ // Due to how this control works, we can't rely on the built-in way of checking for focus visibility.
146+ if (has_focus () && !is_focus_hidden) {
146147 draw_style_box (get_theme_stylebox (SNAME (" focus" ), SNAME (" Tree" )), Rect2 (Point2 (), get_size ()));
147148 }
148149
@@ -296,8 +297,9 @@ bool ProjectListItemControl::should_load_project_icon() const {
296297 return icon_needs_reload;
297298}
298299
299- void ProjectListItemControl::set_selected (bool p_selected) {
300+ void ProjectListItemControl::set_selected (bool p_selected, bool p_hide_focus ) {
300301 is_selected = p_selected;
302+ is_focus_hidden = is_selected && p_hide_focus;
301303 queue_redraw ();
302304 queue_accessibility_update ();
303305}
@@ -1017,7 +1019,7 @@ int ProjectList::get_index(const ProjectListItemControl *p_control) const {
10171019void ProjectList::ensure_project_visible (int p_index) {
10181020 const Item &item = _projects[p_index];
10191021 // Since follow focus is enabled.
1020- item.control ->grab_focus ();
1022+ item.control ->grab_focus (true );
10211023}
10221024
10231025void ProjectList::_create_project_item_control (int p_index) {
@@ -1111,7 +1113,7 @@ void ProjectList::_list_item_input(const Ref<InputEvent> &p_ev, Control *p_hb) {
11111113
11121114 } else {
11131115 _last_clicked = clicked_project.path ;
1114- select_project (clicked_index);
1116+ select_project (clicked_index, true );
11151117 }
11161118
11171119 emit_signal (SNAME (SIGNAL_SELECTION_CHANGED));
@@ -1255,10 +1257,10 @@ void ProjectList::_clear_project_selection() {
12551257 queue_accessibility_update ();
12561258}
12571259
1258- void ProjectList::_select_project_nocheck (int p_index) {
1260+ void ProjectList::_select_project_nocheck (int p_index, bool p_hide_focus ) {
12591261 Item &item = _projects.write [p_index];
12601262 _selected_project_paths.insert (item.path );
1261- item.control ->set_selected (true );
1263+ item.control ->set_selected (true , p_hide_focus );
12621264 queue_accessibility_update ();
12631265}
12641266
@@ -1286,10 +1288,10 @@ void ProjectList::_select_project_range(int p_begin, int p_end) {
12861288 }
12871289}
12881290
1289- void ProjectList::select_project (int p_index) {
1291+ void ProjectList::select_project (int p_index, bool p_hide_focus ) {
12901292 // This method keeps only one project selected.
12911293 _clear_project_selection ();
1292- _select_project_nocheck (p_index);
1294+ _select_project_nocheck (p_index, p_hide_focus );
12931295}
12941296
12951297void ProjectList::deselect_project (int p_index) {
0 commit comments