Skip to content

Commit

Permalink
feat(Scrollspy): enable smooth-scroll behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoSot committed Jun 8, 2022
1 parent 9002188 commit b2e3440
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/src/scrollspy.js
Expand Up @@ -128,7 +128,7 @@ class ScrollSpy extends BaseComponent {
const root = this._rootElement || window
const height = observableSection.offsetTop - this._element.offsetTop
if (root.scrollTo) {
root.scrollTo({ top: height })
root.scrollTo({ top: height, behavior: 'smooth' })
return
}

Expand Down
2 changes: 1 addition & 1 deletion js/tests/unit/scrollspy.spec.js
Expand Up @@ -889,7 +889,7 @@ describe('ScrollSpy', () => {

setTimeout(() => {
if (div.scrollTo) {
expect(clickSpy).toHaveBeenCalledWith({ top: observable.offsetTop - div.offsetTop })
expect(clickSpy).toHaveBeenCalledWith({ top: observable.offsetTop - div.offsetTop, behavior: 'smooth' })
} else {
expect(clickSpy).toHaveBeenCalledWith(observable.offsetTop - div.offsetTop)
}
Expand Down

0 comments on commit b2e3440

Please sign in to comment.