Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review gate: voice dash-joined chords in diagrams, space activates buttons over page shortcuts

[._.]/ Adam Eivyfb582b300361
diff --git a/client/src/components/songbook/ChordDiagram.jsx b/client/src/components/songbook/ChordDiagram.jsx
index d546ea38e0..636df77567 100644
--- a/client/src/components/songbook/ChordDiagram.jsx
+++ b/client/src/components/songbook/ChordDiagram.jsx
@@ -1,5 +1,5 @@
import { memo, useMemo } from 'react';
-import { getChordVoicing } from '../../lib/chordShapes.js';
+import { getChordVoicing, splitJoinedChords } from '../../lib/chordShapes.js';
/**
* Small chord-voicing diagram for the SongBook viewer's instrument views:
@@ -136,9 +136,8 @@ const PianoChips = ({ voicing, size }) => (
</span>
);
-function ChordDiagram({ name, instrument, size = 'md' }) {
- const voicing = useMemo(() => getChordVoicing(name, instrument), [name, instrument]);
-
+const SingleChordDiagram = ({ name, instrument, size }) => {
+ const voicing = getChordVoicing(name, instrument);
if (!voicing) {
return <span className="text-[10px] text-gray-500 italic">no diagram</span>;
}
@@ -153,6 +152,26 @@ function ChordDiagram({ name, instrument, size = 'md' }) {
)}
</span>
);
+};
+
+function ChordDiagram({ name, instrument, size = 'md' }) {
+ // Dash-joined quick changes ("Am-Am7") arrive as one token from the parser —
+ // render one voicing per segment, labeled when there's more than one.
+ const parts = useMemo(() => splitJoinedChords(name), [name]);
+
+ if (parts.length <= 1) {
+ return <SingleChordDiagram name={parts[0] ?? name} instrument={instrument} size={size} />;
+ }
+ return (
+ <span className="inline-flex items-start gap-2">
+ {parts.map((part, i) => (
+ <span key={`${part}-${i}`} className="inline-flex flex-col items-center gap-0.5">
+ <span className="text-[9px] text-gray-500 font-mono leading-tight">{part}</span>
+ <SingleChordDiagram name={part} instrument={instrument} size={size} />
+ </span>
+ ))}
+ </span>
+ );
}
// Pure function of primitive props — memo keeps sheet re-renders (autoscroll
diff --git a/client/src/components/songbook/ChordDiagram.test.jsx b/client/src/components/songbook/ChordDiagram.test.jsx
index 2b7c66661d..5c6d6ecca7 100644
--- a/client/src/components/songbook/ChordDiagram.test.jsx
+++ b/client/src/components/songbook/ChordDiagram.test.jsx
@@ -52,4 +52,19 @@ describe('ChordDiagram', () => {
expect(container.querySelector('svg')).toBeNull();
expect(container.textContent).toContain('no diagram');
});
+
+ it('renders one labeled voicing per segment for dash-joined chords (Am-Am7)', () => {
+ const { container } = render(<ChordDiagram name="Am-Am7" instrument="guitar" />);
+ expect(container.querySelectorAll('svg')).toHaveLength(2);
+ expect(container.textContent).toContain('Am');
+ expect(container.textContent).toContain('Am7');
+ expect(container.textContent).not.toContain('no diagram');
+ });
+
+ it('dash-joined chords render piano chip rows per segment too', () => {
+ const { container } = render(<ChordDiagram name="E-Em7" instrument="piano" />);
+ // E → E G# B; Em7 → E G B D — both segments produce note chips.
+ expect(container.textContent).toContain('G#');
+ expect(container.textContent).toContain('D');
+ });
});
diff --git a/client/src/hooks/useKeyboardShortcuts.js b/client/src/hooks/useKeyboardShortcuts.js
index 5bcb4c214c..3b4fa41d59 100644
--- a/client/src/hooks/useKeyboardShortcuts.js
+++ b/client/src/hooks/useKeyboardShortcuts.js
@@ -40,6 +40,13 @@ export default function useKeyboardShortcuts(active, bindings, { ignoreRepeat =
if (e.metaKey || e.ctrlKey || e.altKey) return;
if (ignoreRepeat && e.repeat) return;
if (isEditableTarget(e.target)) return;
+ // Space on a focused button/link must ACTIVATE it (standard browser
+ // behavior) — a page-level ' ' binding would preventDefault the
+ // activation and fire the shortcut instead (e.g. toggling autoscroll
+ // when the user meant to open a chord popover). Scoped to ' ' only:
+ // letter/arrow shortcuts don't collide with button activation.
+ if (e.key === ' ' && typeof e.target?.closest === 'function'
+ && e.target.closest('button, a, [role="button"]')) return;
if (!enabledInDialog && document.querySelector('[aria-modal="true"]')) return;
const handler = bindingsRef.current[e.key];
if (typeof handler !== 'function') return;
diff --git a/client/src/hooks/useKeyboardShortcuts.test.jsx b/client/src/hooks/useKeyboardShortcuts.test.jsx
index 81a8b7bd33..f4b3c7c4d8 100644
--- a/client/src/hooks/useKeyboardShortcuts.test.jsx
+++ b/client/src/hooks/useKeyboardShortcuts.test.jsx
@@ -98,6 +98,26 @@ describe('useKeyboardShortcuts', () => {
expect(d).toHaveBeenCalledTimes(1);
});
+ it("space on a focused button activates the button, never a page ' ' shortcut", () => {
+ const space = vi.fn();
+ const g = vi.fn();
+ renderHook(() => useKeyboardShortcuts(true, { ' ': space, g }));
+ const btn = document.createElement('button');
+ document.body.appendChild(btn);
+ // Space must fall through to native button activation (no preventDefault).
+ const spaceEvent = press(' ', { target: btn });
+ expect(space).not.toHaveBeenCalled();
+ expect(spaceEvent.defaultPrevented).toBe(false);
+ // Letter shortcuts still fire with a button focused — only ' ' collides
+ // with activation semantics.
+ press('g', { target: btn });
+ expect(g).toHaveBeenCalledTimes(1);
+ btn.remove();
+ // Space from a non-interactive target still drives the page shortcut.
+ press(' ');
+ expect(space).toHaveBeenCalledTimes(1);
+ });
+
it('suppresses shortcuts while an aria-modal dialog is open (page card stays behind it)', () => {
const d = vi.fn();
renderHook(() => useKeyboardShortcuts(true, { d }));
diff --git a/client/src/lib/chordShapes.test.js b/client/src/lib/chordShapes.test.js
index 0806380c1e..49b9a3095d 100644
--- a/client/src/lib/chordShapes.test.js
+++ b/client/src/lib/chordShapes.test.js
@@ -166,6 +166,11 @@ describe('getChordVoicing — piano', () => {
expect(notes('Cadd9')).toEqual(['C', 'E', 'G', 'D']);
expect(notes('C6')).toEqual(['C', 'E', 'G', 'A']);
expect(notes('D9')).toEqual(['D', 'F#', 'A', 'C', 'E']);
+ // dim7 / m6 pinned by exact pitches (not just non-null): the uke-solver
+ // constraint test derives its expected tones from the same interval table,
+ // so these two rows need an independent pin to avoid circular coverage.
+ expect(notes('Cdim7')).toEqual(['C', 'Eb', 'Gb', 'A']); // bbb7 → enharmonic A
+ expect(notes('Cm6')).toEqual(['C', 'Eb', 'G', 'A']);
});
it('spells sharps and flats letter-accurately from the root', () => {