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 (codex): re-anchor duplicate-chord popovers, keep ukulele tab visible in ukulele view, scroll tall popovers

[._.]/ Adam Eivyc93b87f3a59c
diff --git a/client/src/components/songbook/TabSheetView.jsx b/client/src/components/songbook/TabSheetView.jsx
index fd5c90867d..9264690dbf 100644
--- a/client/src/components/songbook/TabSheetView.jsx
+++ b/client/src/components/songbook/TabSheetView.jsx
@@ -162,7 +162,10 @@ function TabSheetView({
width: POPOVER_WIDTH,
position: 'below',
anchorRef: anchorElRef,
- contentDeps: [popover?.name, instrumentView],
+ // popover?.key: tapping a DIFFERENT occurrence of the same chord swaps
+ // the anchor element without changing name/view — the key forces a
+ // re-measure so the dialog moves to the newly-tapped token.
+ contentDeps: [popover?.key, popover?.name, instrumentView],
});
// Tabstaff blocks explicitly expanded while in a non-guitar view.
const [expandedStaffs, setExpandedStaffs] = useState(() => new Set());
@@ -244,11 +247,19 @@ function TabSheetView({
{blocks.map((block, bi) => {
if (block.type === 'tabstaff') {
- // Tab staffs are guitar-specific — collapse them in other views.
- if (instrumentView !== 'guitar' && !expandedStaffs.has(bi)) {
+ // Collapse staffs that don't belong to the active view: a ≥5-line
+ // staff is guitar tab (collapsed outside Guitar view); a ≤4-line
+ // staff is plausibly ukulele/bass tab, so the Ukulele view keeps it
+ // — a uke song's own native tab must not hide under a "guitar tab"
+ // note. Piano has no tablature, so Piano view collapses every staff.
+ const looksGuitar = block.lines.length >= 5;
+ const collapse = instrumentView === 'piano'
+ ? true
+ : instrumentView === 'ukulele' && looksGuitar;
+ if (collapse && !expandedStaffs.has(bi)) {
return (
<div key={bi} className="my-1 flex items-center gap-2 text-xs text-gray-500 italic font-sans">
- <span>guitar tab — switch to Guitar view</span>
+ <span>{looksGuitar ? 'guitar tab — switch to Guitar view' : 'tablature — switch to Guitar or Ukulele view'}</span>
<button
type="button"
onClick={() => setExpandedStaffs((prev) => new Set(prev).add(bi))}
@@ -319,7 +330,10 @@ function TabSheetView({
ref={popoverRef}
role="dialog"
aria-label={`${popover.name} chord voicing`}
- className="fixed z-50 bg-port-card border border-port-border rounded-lg shadow-xl p-3 font-sans"
+ // max-h + overflow: a many-segment dash-joined token wraps voicings
+ // into rows that can exceed a short/mobile viewport — the popover
+ // scrolls internally instead of stranding lower diagrams offscreen.
+ className="fixed z-50 bg-port-card border border-port-border rounded-lg shadow-xl p-3 font-sans max-h-[min(60vh,480px)] overflow-y-auto"
style={popoverStyle ?? { visibility: 'hidden', left: 0, top: 0, width: POPOVER_WIDTH }}
>
<div className="flex items-center justify-between gap-2 mb-1.5">
diff --git a/client/src/components/songbook/TabSheetView.test.jsx b/client/src/components/songbook/TabSheetView.test.jsx
index 732d6f0526..28812fcecb 100644
--- a/client/src/components/songbook/TabSheetView.test.jsx
+++ b/client/src/components/songbook/TabSheetView.test.jsx
@@ -154,13 +154,26 @@ describe('TabSheetView', () => {
expect(screen.queryByText(/switch to Guitar view/)).toBeNull();
});
- it('collapses staff blocks to a note with an inline expand in other views', () => {
+ it('piano view collapses every staff (piano has no tablature) with an inline expand', () => {
render(<TabSheetView text={SAMPLE} instrumentView="piano" />);
expect(screen.queryByText('e|--3--2--|')).toBeNull();
- expect(screen.getByText(/guitar tab — switch to Guitar view/)).toBeTruthy();
+ // The 2-line SAMPLE staff isn't identifiably guitar — generic label.
+ expect(screen.getByText(/tablature — switch to Guitar or Ukulele view/)).toBeTruthy();
fireEvent.click(screen.getByRole('button', { name: 'show' }));
expect(screen.getByText('e|--3--2--|')).toBeTruthy();
expect(screen.getByText('B|--0-----|')).toBeTruthy();
});
+
+ const SIX_LINE_STAFF = ['e|--0--|', 'B|--1--|', 'G|--0--|', 'D|--2--|', 'A|--3--|', 'E|-----|'].join('\n');
+ const FOUR_LINE_STAFF = ['A|--0--|', 'E|--0--|', 'C|--0--|', 'G|--2--|'].join('\n');
+
+ it('ukulele view collapses guitar staffs (≥5 lines) but keeps ≤4-line staffs — a uke song\'s own tab stays visible', () => {
+ render(<TabSheetView text={`${SIX_LINE_STAFF}\n\n${FOUR_LINE_STAFF}`} instrumentView="ukulele" />);
+ // Guitar staff collapsed with the guitar-specific label…
+ expect(screen.queryByText('D|--2--|')).toBeNull();
+ expect(screen.getByText(/guitar tab — switch to Guitar view/)).toBeTruthy();
+ // …while the 4-line (plausibly ukulele) staff renders in place.
+ expect(screen.getByText('G|--2--|')).toBeTruthy();
+ });
});
});
diff --git a/client/src/pages/SongBookViewer.test.jsx b/client/src/pages/SongBookViewer.test.jsx
index 3ae66ebdc1..44b50a9fa4 100644
--- a/client/src/pages/SongBookViewer.test.jsx
+++ b/client/src/pages/SongBookViewer.test.jsx
@@ -115,11 +115,18 @@ describe('SongBookViewer', () => {
describe('instrument-view toggle (#2656)', () => {
// Sheet with a tab staff so the non-guitar collapse note is observable.
+ // Six staff lines: identifiably GUITAR tab, so non-guitar views collapse
+ // it under the guitar-specific label (a ≤4-line staff would stay visible
+ // in ukulele view — pinned in TabSheetView.test.jsx).
const TAB_SHEET = `[Chorus]
C G Am F
Nonsense words here
e|--3--2--|
-B|--0-----|`;
+B|--0-----|
+G|--0-----|
+D|--0-----|
+A|--2-----|
+E|--3-----|`;
it('defaults to the song instrument (guitar) and shows the chords-used strip', async () => {
renderPage();