+##############################################################
+# check if focus is correct after closing an unfocused window
+##############################################################
+
+$tmp = fresh_workspace;
+
+ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
+
+$first = open_empty_con($i3);
+$middle = open_empty_con($i3);
+# XXX: the $right empty con will be filled with the x11 window we are creating afterwards
+$right = open_empty_con($i3);
+my $win = open_standard_window($x, '#00ff00');
+
+cmd qq|[con_id="$middle"] focus|;
+$win->destroy;
+
+sleep 0.25;
+
+is(get_focused($tmp), $middle, 'middle container focused');
+