Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorGeoSot <geo.sotis@gmail.com>2022-06-08 22:35:09 +0300
committerGitHub <noreply@github.com>2022-06-08 22:35:09 +0300
commit37cf7d11b94edf5d6f239cd287b5aae000ede934 (patch)
treea4e427bf188cfd9fae4284c972af0153075637b6 /js
parent90021886f62b06260bdec585d86f6fe6acf02b32 (diff)
Scrollspy: enable smooth-scroll behavior (#36528)
Diffstat (limited to 'js')
-rw-r--r--js/src/scrollspy.js2
-rw-r--r--js/tests/unit/scrollspy.spec.js2
2 files changed, 2 insertions, 2 deletions
diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js
index 323194c534..33447c2bd5 100644
--- a/js/src/scrollspy.js
+++ b/js/src/scrollspy.js
@@ -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
}
diff --git a/js/tests/unit/scrollspy.spec.js b/js/tests/unit/scrollspy.spec.js
index 2cfc480392..2bdeb5830c 100644
--- a/js/tests/unit/scrollspy.spec.js
+++ b/js/tests/unit/scrollspy.spec.js
@@ -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)
}