Skip to content

A platform for community discussion. Free, open, simple.

DEV: replaces jquery scrollTop by vanilla js code (#9543)

Joffrey JAFFEUXd83f39be73ac
diff --git a/app/assets/javascripts/select-kit/components/select-kit.js b/app/assets/javascripts/select-kit/components/select-kit.js
index 76f8dea368e..e5c9394908a 100644
--- a/app/assets/javascripts/select-kit/components/select-kit.js
+++ b/app/assets/javascripts/select-kit/components/select-kit.js
@@ -658,17 +658,10 @@ export default Component.extend(
);
if (rowContainer) {
- const $collection = $(
- this.element.querySelector(".select-kit-collection")
- );
-
- const collectionTop = $collection.position().top;
+ const collectionContainer = rowContainer.parentNode;
- $collection.scrollTop(
- $collection.scrollTop() +
- $(rowContainer).position().top -
- collectionTop
- );
+ collectionContainer.scrollTop =
+ rowContainer.offsetTop - collectionContainer.offsetTop;
}
},