diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js index 49b99dd18..5f2839cf2 100644 --- a/js/ui/switcherPopup.js +++ b/js/ui/switcherPopup.js @@ -255,7 +255,15 @@ var SwitcherPopup = GObject.registerClass({ _itemRemovedHandler(n) { if (this._items.length > 0) { - let newIndex = Math.min(n, this._items.length - 1); + let newIndex; + + if (n < this._selectedIndex) + newIndex = this._selectedIndex - 1; + else if (n === this._selectedIndex) + newIndex = Math.min(n, this._items.length - 1); + else if (n > this._selectedIndex) + return; // No need to select something new in this case + this._select(newIndex); } else { this.fadeAndDestroy();