From f740741fb908fb929041ec8560d717b4cebdd950 Mon Sep 17 00:00:00 2001 From: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Sat, 8 Feb 2025 10:29:12 +0000 Subject: [PATCH] Update actions-overflow.js --- .../js/components/header/actions-overflow.js | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/js/components/header/actions-overflow.js b/src/main/js/components/header/actions-overflow.js index cf8622a629f6..4feca6d1e7b2 100644 --- a/src/main/js/components/header/actions-overflow.js +++ b/src/main/js/components/header/actions-overflow.js @@ -28,6 +28,11 @@ export default function computeActions() { while (actionsOverflows()) { const item = actions.pop(); + + if (!item) { + break; + } + items.unshift(item); item.classList.add("jenkins-hidden"); } @@ -55,13 +60,16 @@ export default function computeActions() { // We want to disable the User action href on touch devices so that they can still activate the overflow menu const link = document.querySelector("#root-action-UserAction"); - const originalHref = link.getAttribute("href"); - const isTouchDevice = window.matchMedia("(hover: none)").matches; - if (isTouchDevice) { - link.removeAttribute("href"); - } else { - link.setAttribute("href", originalHref); + if (link) { + const originalHref = link.getAttribute("href"); + const isTouchDevice = window.matchMedia("(hover: none)").matches; + + if (isTouchDevice) { + link.removeAttribute("href"); + } else { + link.setAttribute("href", originalHref); + } } }