diff --git a/src/window.cpp b/src/window.cpp index bb7787581afd9..a2332eb65f738 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1351,7 +1351,8 @@ static void BringWindowToFront(Window *w, bool dirty) { auto priority = GetWindowZPriority(w->window_class); WindowList::iterator dest = _z_windows.begin(); - while (dest != _z_windows.end() && (*dest == nullptr || GetWindowZPriority((*dest)->window_class) <= priority)) ++dest; + /* Dropdowns and Pickers use WC_INVALID to hide themselves until deletion. */ + while (dest != _z_windows.end() && (*dest == nullptr || (*dest)->window_class == WC_INVALID || GetWindowZPriority((*dest)->window_class) <= priority)) ++dest; if (dest != w->z_position) { _z_windows.splice(dest, _z_windows, w->z_position);