mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-07 06:06:47 +02:00
Scrollspy: enable smooth-scroll behavior (#36528)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user