fix: RIT Ctrl+arrow tuning also works while the QSO entry field has focus
The radio-style Ctrl+left/right RIT shortcut skipped any focused input/textarea (to preserve word navigation), but that's exactly where the operator's focus is mid-QSO. Now only the RIT offset row itself is skipped; text-field word nav is overridden only while RIT is engaged. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
@@ -320,15 +320,18 @@ export function FlexPanel({ onCWSpeed, onReportRST }: { onCWSpeed?: (wpm: number
|
|||||||
const rxOff = off || !st.rx_avail;
|
const rxOff = off || !st.rx_avail;
|
||||||
|
|
||||||
// Radio-style global RIT tuning: Ctrl+←/→ nudges the RIT offset (Ctrl+Shift =
|
// Radio-style global RIT tuning: Ctrl+←/→ nudges the RIT offset (Ctrl+Shift =
|
||||||
// ±100 Hz) from anywhere, without having to click the RIT field first. A
|
// ±100 Hz) from ANYWHERE — including while the callsign/RST entry field has
|
||||||
// focused offset row (data-offsetrow) or a text field handles its own keys, so
|
// focus, which is where the operator is while working a station. Only the RIT
|
||||||
// this never double-fires. Only active while RIT is on and the RX is available.
|
// offset row itself (data-offsetrow) is skipped, since it handles its own
|
||||||
|
// arrows. Text-field word navigation via Ctrl+← / → is overridden only while
|
||||||
|
// RIT is actually engaged (guarded below), which is fine mid-QSO. Requires RIT
|
||||||
|
// on and the RX available.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onKey = (e: KeyboardEvent) => {
|
const onKey = (e: KeyboardEvent) => {
|
||||||
if (!(e.ctrlKey || e.metaKey)) return;
|
if (!(e.ctrlKey || e.metaKey)) return;
|
||||||
if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight') return;
|
if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight') return;
|
||||||
const ae = document.activeElement as HTMLElement | null;
|
const ae = document.activeElement as HTMLElement | null;
|
||||||
if (ae && (ae.hasAttribute('data-offsetrow') || /^(input|textarea|select)$/i.test(ae.tagName) || ae.isContentEditable)) return;
|
if (ae && ae.hasAttribute('data-offsetrow')) return;
|
||||||
if (!st.rit || rxOff) return;
|
if (!st.rit || rxOff) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const mag = e.shiftKey ? 100 : 10;
|
const mag = e.shiftKey ? 100 : 10;
|
||||||
|
|||||||
Reference in New Issue
Block a user