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

fix: stop the chord transport advertising a key its preview hosts don't bind (#4104)

[._.]/ Adam Eivy4d0c6e0bca41
diff --git a/client/src/components/songbook/ChordTransportBar.jsx b/client/src/components/songbook/ChordTransportBar.jsx
index 07c1fb71aa..23815c0016 100644
--- a/client/src/components/songbook/ChordTransportBar.jsx
+++ b/client/src/components/songbook/ChordTransportBar.jsx
@@ -38,6 +38,10 @@ export default function ChordTransportBar({
countInBars, onCountInChange,
clickEnabled, onClickToggle,
chordCount = 0, pulse = null,
+ // The host's keyboard shortcut for Play, if it binds one. Only the viewer's
+ // play mode does (`p`), so the editor and importer previews must NOT advertise
+ // a key that does nothing there — hence a prop rather than a baked-in hint.
+ keyHint = '',
}) {
// Setup controls: collapsed by default on a phone, always shown from `sm` up.
const [showSetup, setShowSetup] = useState(false);
@@ -53,7 +57,7 @@ export default function ChordTransportBar({
playing={playing}
onToggle={onToggle}
hasMusic={hasChords}
- hint="(p)"
+ hint={keyHint}
emptyHint="Nothing to play — this sheet has no playable chords"
/>
diff --git a/client/src/components/songbook/ChordTransportBar.test.jsx b/client/src/components/songbook/ChordTransportBar.test.jsx
index c31b037638..caed025f0b 100644
--- a/client/src/components/songbook/ChordTransportBar.test.jsx
+++ b/client/src/components/songbook/ChordTransportBar.test.jsx
@@ -33,6 +33,15 @@ describe('ChordTransportBar', () => {
expect(screen.getByLabelText('Turn the metronome on')).toBeTruthy();
});
+ it('advertises a keyboard shortcut only when the host actually binds one', () => {
+ // The editor and importer previews bind no key, so their tooltip must not
+ // name one; the viewer's play mode passes its own.
+ const { rerender } = renderBar();
+ expect(screen.getByLabelText('Play along').getAttribute('title')).toBe('Play along');
+ rerender(<ChordTransportBar {...base} keyHint="(p)" />);
+ expect(screen.getByLabelText('Play along').getAttribute('title')).toBe('Play along (p)');
+ });
+
it('disables Play when the sheet has nothing playable, and says why', () => {
renderBar({ hasChords: false });
const play = screen.getByLabelText('Play along');
diff --git a/client/src/components/songbook/TransportControls.jsx b/client/src/components/songbook/TransportControls.jsx
index 5c100afc24..709d48b81b 100644
--- a/client/src/components/songbook/TransportControls.jsx
+++ b/client/src/components/songbook/TransportControls.jsx
@@ -27,20 +27,25 @@ export const COUNT_IN_OPTIONS = [0, 1, 2];
/**
* Play/stop. `hasMusic` false disables it: a transport that silently does
- * nothing reads as broken, so the reason lives in the title instead.
+ * nothing reads as broken, so the reason lives in the title instead. `hint` is
+ * the host's keyboard shortcut, e.g. `'(space)'` — omitted where the host binds
+ * none, so a tooltip can't advertise a key that does nothing.
*/
-export const PlayStopButton = ({ playing, onToggle, hasMusic = true, hint, emptyHint }) => (
- <button
- type="button"
- onClick={onToggle}
- disabled={!hasMusic}
- className={`${ctrlBtnClass} disabled:opacity-40 disabled:hover:bg-transparent ${playing ? activeCtrlClass : ''}`}
- aria-label={playing ? 'Stop play-along' : 'Play along'}
- title={hasMusic ? (playing ? `Stop ${hint}` : `Play along ${hint}`) : emptyHint}
- >
- {playing ? <Square size={16} /> : <Play size={18} />}
- </button>
-);
+export const PlayStopButton = ({ playing, onToggle, hasMusic = true, hint = '', emptyHint }) => {
+ const action = playing ? 'Stop' : 'Play along';
+ return (
+ <button
+ type="button"
+ onClick={onToggle}
+ disabled={!hasMusic}
+ className={`${ctrlBtnClass} disabled:opacity-40 disabled:hover:bg-transparent ${playing ? activeCtrlClass : ''}`}
+ aria-label={playing ? 'Stop play-along' : 'Play along'}
+ title={hasMusic ? [action, hint].filter(Boolean).join(' ') : emptyHint}
+ >
+ {playing ? <Square size={16} /> : <Play size={18} />}
+ </button>
+ );
+};
/**
* Practice tempo — steppers everywhere, slider only where there's room. The
diff --git a/client/src/pages/SongBookViewer.jsx b/client/src/pages/SongBookViewer.jsx
index b8f66a0be8..10cff624ed 100644
--- a/client/src/pages/SongBookViewer.jsx
+++ b/client/src/pages/SongBookViewer.jsx
@@ -874,6 +874,8 @@ export default function SongBookViewer() {
onClickToggle={chord.setClickEnabled}
chordCount={chord.chordCount}
pulse={chord.pulse}
+ // Play mode is the only host that binds a key for this transport.
+ keyHint="(p)"
/>
)}