From b19276879de988f35c2217c6cd0ba817f7eda94a Mon Sep 17 00:00:00 2001 From: Markus Winter Date: Mon, 12 Feb 2024 23:17:29 +0100 Subject: [PATCH] followup for #8941, don't animate on page load PR #8941 caused a regression that the hiding animation was played on page load. This change ensures that the hiding animation is only applied when the widget was visible before --- .../management/AdministrativeMonitorsDecorator/resources.css | 5 ++++- .../management/AdministrativeMonitorsDecorator/resources.js | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/main/resources/jenkins/management/AdministrativeMonitorsDecorator/resources.css b/core/src/main/resources/jenkins/management/AdministrativeMonitorsDecorator/resources.css index 0630ae99e731..f5299de6c20d 100644 --- a/core/src/main/resources/jenkins/management/AdministrativeMonitorsDecorator/resources.css +++ b/core/src/main/resources/jenkins/management/AdministrativeMonitorsDecorator/resources.css @@ -50,10 +50,13 @@ box-shadow: var(--dropdown-box-shadow); border-radius: 15px; opacity: 0; - animation: hide-am-list 300ms ease-in 1 normal; z-index: 0; } +.am-container.am-hidden div.am-list { + animation: hide-am-list 300ms ease-in 1 normal; +} + .am-container.visible div.am-list { opacity: 1; animation: show-am-list 300ms ease-in 1 normal forwards; diff --git a/core/src/main/resources/jenkins/management/AdministrativeMonitorsDecorator/resources.js b/core/src/main/resources/jenkins/management/AdministrativeMonitorsDecorator/resources.js index 7278b6021ddf..5982e0302570 100644 --- a/core/src/main/resources/jenkins/management/AdministrativeMonitorsDecorator/resources.js +++ b/core/src/main/resources/jenkins/management/AdministrativeMonitorsDecorator/resources.js @@ -38,6 +38,7 @@ var popupContent = responseText; amList.innerHTML = popupContent; amMonitorRoot.classList.add("visible"); + amMonitorRoot.classList.remove("am-hidden"); document.addEventListener("click", onClose); document.addEventListener("keydown", onEscClose); @@ -50,6 +51,9 @@ } function close() { + if (amMonitorRoot.classList.contains("visible")) { + amMonitorRoot.classList.add("am-hidden"); + } amMonitorRoot.classList.remove("visible"); document.removeEventListener("click", onClose); document.removeEventListener("keydown", onEscClose);