Layar hasil memfokuskan wadahnya, bukan tombol MAIN LAGI: Spasi/Enter yang masih ditekan dari pertarungan tidak lagi memulai ulang seketika (Tab tetap menjangkau tombol)

This commit is contained in:
rizkyaz0 2026-10-04 00:40:45 +07:00
parent fd3d770979
commit fb6abadc92
2 changed files with 5 additions and 3 deletions

1
vs.css
View File

@ -57,6 +57,7 @@
/* ---- Layar hasil (menu.js screen 'result' memakai ResultView) ---- */
#front-menu[data-screen=result]{display:flex;flex-direction:column;overflow:hidden}
.rs{--cw:#e0bf85;--cl:#7a8f95;position:relative;flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,.9fr) minmax(320px,1.75fr) minmax(0,.62fr);column-gap:clamp(8px,2vw,32px);align-items:stretch;width:100%;max-width:1700px;margin:0 auto;padding:0 3vw}
.rs:focus{outline:0}
.rs-confetti{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:4}
.rs-confetti i{position:absolute;top:-16px;left:var(--x);width:var(--w);height:calc(var(--w)*1.6);background:var(--c);opacity:0;animation:rs-fall var(--t) var(--d) ease-in both}
.rs-fighter{position:relative;min-width:0;min-height:0}

7
vs.js
View File

@ -1,7 +1,7 @@
/* Layar VS (RENCANA 2.2), tampilan layar hasil (RENCANA 2.3) dan pemilih kutipan (RENCANA 2.6). Gaya: vs.css, data kutipan: content/quotes.js.
- window.VS.show(info, onDone): overlay sekitar 2,2 detik sebelum ronde 1. onDone dipanggil tepat satu kali (waktu habis atau dilewati
dengan klik/Spasi/Enter/Esc); setelah itu game memulai urutan cue ronde seperti biasa (game.js startMatch -> emitRoundCue).
- window.ResultView.view(hasil, ctx) -> {title, eyebrow, html}; ResultView.mount(root) menghidupkan hitungan koin dan fokus tombol.
- window.ResultView.view(hasil, ctx) -> {title, eyebrow, html}; ResultView.mount(root) menghidupkan hitungan koin dan memberi fokus ke wadah layar.
Pengacak di sini kosmetik saja (bukan random() mesin), jadi tidak memengaruhi hasil pertandingan. */
(() => {
'use strict';
@ -113,7 +113,7 @@
+ `<div class="rs-fighter lose"><img class="rs-art" src="${esc(artOf(Lf))}" alt="${esc(Lf.name)}" draggable="false"><div class="rs-plate"><small>${esc(Lf.name)}</small><p>&ldquo;${esc(q.lose)}&rdquo;</p></div></div></div>`;
return { title: run ? (run.kind === 'arcade' ? 'MODE ARCADE' : 'MODE SURVIVAL') : 'PERTANDINGAN SELESAI', eyebrow: stName ? stName.toUpperCase() : 'KONOHA FIGHTING', html };
}
// Setelah html dipasang: hitung naik angka koin dan fokuskan "Main lagi" (kecuali layar sentuh).
// Setelah html dipasang: hitung naik angka koin dan fokuskan wadah layar hasil (kecuali layar sentuh).
function mount(root) {
const rs = root.querySelector('.rs'); if (!rs) return;
const calm = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
@ -124,7 +124,8 @@
n.textContent = '◆ +0'; requestAnimationFrame(tick);
setTimeout(() => { if (n.isConnected) n.textContent = '◆ +' + to; }, 700 + dur + 400);
}
if (!document.documentElement.classList.contains('touch')) rs.querySelector('.rs-again')?.focus({ preventScroll: true });
// Fokus ke wadah (bukan tombol): Spasi/Enter yang masih ditekan dari pertarungan tidak boleh langsung mengaktifkan MAIN LAGI; Tab tetap menjangkau tombol.
if (!document.documentElement.classList.contains('touch')) { rs.tabIndex = -1; rs.focus({ preventScroll: true }); }
}
window.ResultView = { view, mount };
})();