Fix piano key release while command palette is open

This commit is contained in:
Jage9
2026-03-08 19:53:00 -04:00
parent 5dafc05c8e
commit 3d9405bff9
2 changed files with 7 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
// Maintainer-controlled web client version.
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
window.CHGRID_WEB_VERSION = "2026.03.08 R337";
window.CHGRID_WEB_VERSION = "2026.03.08 R338";
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
window.CHGRID_TIME_ZONE = "America/Detroit";

View File

@@ -2607,6 +2607,10 @@ function canOpenCommandPaletteInMode(mode: GameMode): boolean {
return mode === 'normal' || mode === 'pianoUse' || mode === 'commandPalette';
}
function shouldForwardPianoKeyUp(currentMode: GameMode): boolean {
return currentMode === 'pianoUse' || (currentMode === 'commandPalette' && commandPaletteReturnMode === 'pianoUse');
}
function openCommandPalette(): void {
const sourceMode = state.mode;
if (sourceMode === 'commandPalette') {
@@ -3772,8 +3776,8 @@ function setupInputHandlers(): void {
document.addEventListener('keyup', (event) => {
const code = normalizeInputCode(event);
if (state.mode === 'pianoUse' && code) {
itemBehaviorRegistry.handleModeKeyUp(state.mode, {
if (code && shouldForwardPianoKeyUp(state.mode)) {
itemBehaviorRegistry.handleModeKeyUp('pianoUse', {
code,
shiftKey: event.shiftKey,
});