diff --git a/playground/js/a-app.js b/playground/js/a-app.js index 85a53e4..9ce57d9 100644 --- a/playground/js/a-app.js +++ b/playground/js/a-app.js @@ -1176,6 +1176,10 @@ function wireKeyboard() { } } + // Don't intercept keys when an input/select has focus + const tag = document.activeElement?.tagName; + if (tag === 'INPUT' || tag === 'SELECT' || tag === 'TEXTAREA') return; + if (e.key === '1' || e.code === 'Numpad1') { e.preventDefault(); onThumbsDown(); diff --git a/playground/js/app.js b/playground/js/app.js index e01a9bc..6f5048c 100644 --- a/playground/js/app.js +++ b/playground/js/app.js @@ -432,6 +432,8 @@ function onKeyDown(e) { } if (!followMode || e.repeat) return; + const tag = e.target.tagName; + if (tag === 'INPUT' || tag === 'SELECT' || tag === 'TEXTAREA') return; if (e.key === '1' || e.code === 'Numpad1') { e.preventDefault(); onThumbsDown(); diff --git a/playground/js/b-app.js b/playground/js/b-app.js index 055a7ef..b2ee506 100644 --- a/playground/js/b-app.js +++ b/playground/js/b-app.js @@ -1130,13 +1130,13 @@ function clearState() { // ============================ window.addEventListener('keydown', (e) => { if (e.repeat) return; + const tag = e.target.tagName; + if (tag === 'INPUT' || tag === 'SELECT' || tag === 'TEXTAREA') return; // RL shortcuts: 1=negative, 2=positive if (e.key === '1' || e.code === 'Numpad1') { e.preventDefault(); onThumbsDown(); } if (e.key === '2' || e.code === 'Numpad2') { e.preventDefault(); onThumbsUp(); } // Follow mode toggle: f if (e.key === 'f' || e.key === 'F') { - // Don't toggle if user is typing in an input - if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'SELECT') return; e.preventDefault(); toggleFollowMode(); } diff --git a/playground/js/c-app.js b/playground/js/c-app.js index 5c41167..17b47c5 100644 --- a/playground/js/c-app.js +++ b/playground/js/c-app.js @@ -268,6 +268,8 @@ function init() { // Keyboard shortcuts for RL (work in all phases) window.addEventListener('keydown', (e) => { if (e.repeat) return; + const tag = e.target.tagName; + if (tag === 'INPUT' || tag === 'SELECT' || tag === 'TEXTAREA') return; if (e.key === '1' || e.code === 'Numpad1') { e.preventDefault(); onThumbsDown();