From 6487273ced6df4773459b9aebb543cba375421fa Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 21 Dec 2018 14:37:01 +0000 Subject: [PATCH] Fix sticky with find as you type It was losing its position because filtering the list of templates with find as you type was causing the height of the page to change. --- app/assets/javascripts/liveSearch.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/assets/javascripts/liveSearch.js b/app/assets/javascripts/liveSearch.js index 240b84114..25cf880e5 100644 --- a/app/assets/javascripts/liveSearch.js +++ b/app/assets/javascripts/liveSearch.js @@ -27,6 +27,12 @@ }); + // make sticky JS recalculate its cache of the element's position + // because live search can change the height document + if ('stickAtBottomWhenScrolling' in GOVUK) { + GOVUK.stickAtBottomWhenScrolling.recalculate(); + } + };