diff --git a/iron-list.html b/iron-list.html index fa0313c0..c50ca184 100644 --- a/iron-list.html +++ b/iron-list.html @@ -1836,6 +1836,7 @@ // Hide the physical item that backfills. this.translate3d(0, HIDDEN_Y, 0, this._focusBackfillItem); } else { + this._removeFocusedItem(); this._focusBackfillItem = null; } this._offscreenFocusedItem = null; diff --git a/test/focus.html b/test/focus.html index 93abff91..fdb2cb8d 100644 --- a/test/focus.html +++ b/test/focus.html @@ -108,15 +108,21 @@ list.items = buildDataSet(100); Polymer.dom.flush(); - + list.scroll(0, getFirstItemFromList(list).offsetHeight * list._physicalCount); requestAnimationFrame(function() { setTimeout(function() { + var lastOffscreenFocusedItem = list._offscreenFocusedItem; var firstItem = getFirstItemFromList(list); - firstItem.parentNode.focus(); + MockInteractions.focus(firstItem.parentNode); + + Polymer.dom.flush(); + assert.equal(firstItem, getFirstItemFromList(list), 'Should be the same item after focusing it'); + assert.isNull(lastOffscreenFocusedItem.parentNode, + 'Should remove the last offscreen focused item'); done(); }); });