From 32d8691862432ed05501a46d2bd712b2bc4e192e Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 28 Jul 2023 14:49:38 +0200 Subject: [PATCH] Fix the jump to the option being searched for Fixes #5580 --- wcfsetup/install/files/acp/templates/option.tpl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/option.tpl b/wcfsetup/install/files/acp/templates/option.tpl index 9305aa4c1e..1e68a60f36 100644 --- a/wcfsetup/install/files/acp/templates/option.tpl +++ b/wcfsetup/install/files/acp/templates/option.tpl @@ -12,7 +12,7 @@ const optionName = searchParams.get("optionName"); if (optionName) { window.setTimeout(() => { - const element = document.getElementById(optionName); + const element = document.querySelector(`#${ optionName }, label[for="${ optionName }"]`); if (!element) { return; } @@ -24,14 +24,17 @@ const elementTop = Math.trunc(element.getBoundingClientRect().top); window.scrollTo(0, elementTop - 50); - element.focus(); + + try { + element.focus(); + } catch {} window.setTimeout(() => { const label = dl.querySelector("dt label"); label.classList.add("hightlightOptionLabel"); label.addEventListener("transitionEnd",() => label.classList.remove("hightlightOptionLabel"), { once: true }); }, 500); - }, 200); + }, 1_000); } }); -- 2.20.1