From 5eddb0b0fdfd7215d5764c5315ce7f0be4ca3d83 Mon Sep 17 00:00:00 2001 From: Rob Ruana Date: Sun, 27 Nov 2016 16:20:33 -0800 Subject: Closes #21055: Prevents ScrollSpy from clearing active item when Safari rubberbands (#21056) When the rubberband effect causes Safari to scroll past the top of the page, the value of scrollTop becomes negative. If the offset of the first ScrollSpy target is 0 - essentially if the target is at the top of the page - then ScrollSpy should not clear the active item. Conceptually, the first item should remain active when rubberbanding past the top of the page. This commit fixes issue #21055 by verifying the first scrollspy target is not at the top of the page before clearing the active nav-item. --- js/src/scrollspy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src') diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index 9b39acd36..9cb1438ca 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -221,7 +221,7 @@ const ScrollSpy = (($) => { return } - if (this._activeTarget && scrollTop < this._offsets[0]) { + if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { this._activeTarget = null this._clear() return -- cgit v1.2.3