Fix piano key release while command palette is open
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Maintainer-controlled web client version.
|
// Maintainer-controlled web client version.
|
||||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
// 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.
|
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||||
|
|||||||
@@ -2607,6 +2607,10 @@ function canOpenCommandPaletteInMode(mode: GameMode): boolean {
|
|||||||
return mode === 'normal' || mode === 'pianoUse' || mode === 'commandPalette';
|
return mode === 'normal' || mode === 'pianoUse' || mode === 'commandPalette';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function shouldForwardPianoKeyUp(currentMode: GameMode): boolean {
|
||||||
|
return currentMode === 'pianoUse' || (currentMode === 'commandPalette' && commandPaletteReturnMode === 'pianoUse');
|
||||||
|
}
|
||||||
|
|
||||||
function openCommandPalette(): void {
|
function openCommandPalette(): void {
|
||||||
const sourceMode = state.mode;
|
const sourceMode = state.mode;
|
||||||
if (sourceMode === 'commandPalette') {
|
if (sourceMode === 'commandPalette') {
|
||||||
@@ -3772,8 +3776,8 @@ function setupInputHandlers(): void {
|
|||||||
|
|
||||||
document.addEventListener('keyup', (event) => {
|
document.addEventListener('keyup', (event) => {
|
||||||
const code = normalizeInputCode(event);
|
const code = normalizeInputCode(event);
|
||||||
if (state.mode === 'pianoUse' && code) {
|
if (code && shouldForwardPianoKeyUp(state.mode)) {
|
||||||
itemBehaviorRegistry.handleModeKeyUp(state.mode, {
|
itemBehaviorRegistry.handleModeKeyUp('pianoUse', {
|
||||||
code,
|
code,
|
||||||
shiftKey: event.shiftKey,
|
shiftKey: event.shiftKey,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user