From: Alexander Ebert Date: Fri, 28 Jul 2023 12:49:38 +0000 (+0200) Subject: Fix the jump to the option being searched for X-Git-Tag: 6.0.0_Alpha_8~40 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=32d8691862432ed05501a46d2bd712b2bc4e192e;p=GitHub%2FWoltLab%2FWCF.git Fix the jump to the option being searched for Fixes #5580 --- 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); } });