Skip to content

Commit

Permalink
Bugfix for updated on selected when position was on last in queue and…
Browse files Browse the repository at this point in the history
… nod got removed in action. refs #19614
  • Loading branch information
JockeCK committed Sep 28, 2018
1 parent 52f5c33 commit 78726d2
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions cosmoz-data-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,15 +489,20 @@
* @return {void}
*/
_updateSelected(selected = this.selected, previous) {
this._setSelectedNext((selected || 0) + 1);
this._preload(selected);
const position = selected < this.items.length ? selected : selected - 1;
this._setSelectedNext((position || 0) + 1);
this._preload(position);

const element = this._getElement(selected);
const element = this._getElement(position);

this._updateHashForSelected(selected);
if (!element) {
return;
}

this._updateHashForSelected(position);

const classes = element.classList,
animating = this.animating && previous != null && previous !== selected,
animating = this.animating && previous != null && previous !== position,
prev = animating && this._getElement(previous);

if (!animating) {
Expand Down Expand Up @@ -575,7 +580,7 @@
return {
prevDisabled: index < 1,
nextDisabled: index + 1 >= this.items.length,
[this.indexAs]: Math.max(index, 0)
[this.indexAs]: Math.min(Math.max(index, 0), this.items.length - 1)
};
},

Expand Down

0 comments on commit 78726d2

Please sign in to comment.