fix(licensing): simplify S08 and reveal linked stage without losing context

This commit is contained in:
2026-11-10 11:00:56 +02:00
parent 95def7f75e
commit 6734441855
3 changed files with 315 additions and 18 deletions
+15
View File
@@ -0,0 +1,15 @@
/** Reveal an existing stage without navigation, remounting fields or changing context. */
export function revealPathStage(root: HTMLElement, hash: string, codes: string[]): boolean {
const code = hash.startsWith("#") ? hash.slice(1) : "";
if (!codes.includes(code)) return false;
const target = root.ownerDocument.getElementById(code);
if (!target || !root.contains(target)) return false;
let current: HTMLElement | null = target;
while (current && current !== root) {
if (current.tagName === "DETAILS") (current as HTMLDetailsElement).open = true;
current = current.parentElement;
}
target.scrollIntoView({ block: "start" });
target.focus({ preventScroll: true });
return true;
}