From 6d44d4c0eb4b9c5d1b005f8573daa40fcc5ed710 Mon Sep 17 00:00:00 2001 From: David R Date: Fri, 11 Aug 2023 09:42:20 +0100 Subject: [PATCH] Fixes: Opening dropdown does not scroll to selected option first time, but does second time Fix for issue: The dropdown renders with an option selected. But when I click to open the dropdown, it does not show the selected option, but instead the list is at the top. However, close the dropdown and click to open it again and this time it will be scrolled to the selected option. #2838 --- js/bootstrap-select.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/bootstrap-select.js b/js/bootstrap-select.js index 7055df413..c48f51f5a 100644 --- a/js/bootstrap-select.js +++ b/js/bootstrap-select.js @@ -2703,6 +2703,8 @@ } this.$element.on('shown' + EVENT_KEY, function () { + that.createView(false, true); + if (that.$menuInner[0].scrollTop !== that.selectpicker.view.scrollTop) { that.$menuInner[0].scrollTop = that.selectpicker.view.scrollTop; }