fix(공용): 떠남 [취소] 뒤 단계 [<] [>] 흐려짐 — 주소 되돌림 알림 (PLAN 572)
- main.ts 취소 갈래 = replaceState 뒤 aislo:route-restored 냄(hashchange 가 안 뜸) - ui_template_help [<] [>] sync 가 그 알림에도 다시 맞춤 · 화면에서 빠지면 둘 다 풂 - test_401 소스 대조 하나 더함 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -344,6 +344,9 @@ function createStepNavButton(step: -1 | 1): HTMLButtonElement {
|
||||
return button;
|
||||
}
|
||||
|
||||
/** 떠남 [취소] 뒤 주소를 되돌렸다는 알림(`main.ts` 가 냄 · hashchange 가 안 뜸). */
|
||||
export const ROUTE_RESTORED_EVENT = "aislo:route-restored";
|
||||
|
||||
/** 지금 주소의 묶음 · [<] [>] 차례 — 목록 밖이면 차례 -1 */
|
||||
function stepNavIndex(): { index: number; last: number } {
|
||||
const route = location.hash.replace(/^#\/?/, "").split("?")[0];
|
||||
@@ -364,11 +367,16 @@ export function placeHelpButton(actions: HTMLElement): void {
|
||||
prev.disabled = index <= 0;
|
||||
next.disabled = index === last;
|
||||
};
|
||||
// 떠남 [취소] 는 주소만 되돌림(hashchange 없음) — 「되돌림」 알림에도 다시 맞춤(572)
|
||||
const onHash = (): void => {
|
||||
if (prev.isConnected) sync();
|
||||
else window.removeEventListener("hashchange", onHash); // 화면에서 빠짐 — 풂
|
||||
else {
|
||||
window.removeEventListener("hashchange", onHash); // 화면에서 빠짐 — 풂
|
||||
window.removeEventListener(ROUTE_RESTORED_EVENT, onHash);
|
||||
}
|
||||
};
|
||||
sync();
|
||||
window.addEventListener("hashchange", onHash);
|
||||
window.addEventListener(ROUTE_RESTORED_EVENT, onHash);
|
||||
row.prepend(createHelpButton(), prev, next);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user