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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix([issue-12593]): show scroll chevrons when a desktop tab bar overflows (#12726)
[._.]/c74e6eed2445
diff --git a/client/src/components/ui/TabPills.jsx b/client/src/components/ui/TabPills.jsxindex c8c5733e17..5e45a1723f 100644--- a/client/src/components/ui/TabPills.jsx+++ b/client/src/components/ui/TabPills.jsx@@ -10,7 +10,10 @@// `mobileCompact` is the phone treatment for a bar with more tabs than fit at// 375px. It collapses to an ICON-ONLY row below `sm` — same buttons, same// tablist, labels kept for screen readers — with chevrons at whichever edge is-// still scrollable. That is a deliberate product preference over a `<select>`+// still scrollable. The same chevrons show on a labelled underline or pills+// strip at every width: padding usually clips that row after a whole word, so+// the cut is not a cue that more tabs exist (#12593). `filter` chip rows are+// left alone. That is a deliberate product preference over a `<select>`// (#7283 swapped to one and it reads as a form control, not navigation): icons// keep every destination one tap away and keep the bar looking like a nav.// A tab list where any tab has no icon has nothing to render in that row and@@ -46,10 +49,9 @@ const SIZE = {md: { text: 'text-sm', icon: 16, padding: 'px-3 sm:px-4 py-3', gap: 'gap-2' },};-// Chevrons are the only overflow cue an icon row gets — with labels gone there-// is no half-clipped word hinting that the strip continues. They sit in flow-// beside the strip rather than over it, so they never cover a destination.-const ARROW_CLASS = 'sm:hidden shrink-0 flex min-w-[44px] min-h-[44px] items-center justify-center self-stretch px-1 text-gray-400 hover:text-white';+// In flow beside the strip, never over a tab. 44px is the phone touch target,+// and the buttons stay visible at every breakpoint.+const ARROW_CLASS = 'shrink-0 flex min-w-[44px] min-h-[44px] items-center justify-center self-stretch px-1 text-gray-400 hover:text-white';export default function TabPills({tabs,@@ -88,6 +90,9 @@ export default function TabPills({// whole bar rather than rendering a gap the user can't aim at.const iconRow = mobileCompact && visibleTabs.every((t) => t.icon);const selectFallback = mobileCompact && !iconRow;+ // Filter chip rows are not a scroll strip. Every other bar, including the+ // compact icon row of any variant, gets the overflow measure and chevrons.+ const scrollCue = iconRow || variant !== 'filter';// Reveal only inside the horizontal tab strip. scrollIntoView also scrolls// ancestors, pulling a mobile page away from its task form/content.@@ -122,15 +127,19 @@ export default function TabPills({syncPosition();}, [syncPosition]);- useEffect(() => { if (iconRow) measure(); }, [iconRow, measure, visibleTabs.length]);+ useEffect(() => { if (scrollCue) measure(); }, [scrollCue, measure, visibleTabs.length]);useEffect(() => {const strip = stripRef.current;- if (!iconRow || !strip || typeof ResizeObserver === 'undefined') return undefined;+ if (!scrollCue || !strip || typeof ResizeObserver === 'undefined') return undefined;const observer = new ResizeObserver(measure);observer.observe(strip);+ // The strip's own box stays put when a label or count badge widens a tab.+ // ResizeObserver only reports the elements it is given, so each tab has to+ // be one of them or maxScrollRef stays stale and the chevron never appears.+ for (const child of strip.children) observer.observe(child);return () => observer.disconnect();- }, [iconRow, measure]);+ }, [scrollCue, measure, visibleTabs.length]);const scrollStrip = (direction) => {const strip = stripRef.current;@@ -196,12 +205,13 @@ export default function TabPills({</div>) : null;- // One strip, wrapped in an arrow row only when compact — an extra flex- // wrapper on every bar would break the callers that size this thing. The- // wrapper IS the bar when it exists, so the caller's `className` and the- // underline move onto it; the strip keeps only what makes it the scroller.- const withArrows = (strip) => (iconRow ? (- <div className={`flex min-w-0 items-stretch ${variant === 'underline' ? 'border-b border-port-border' : ''} ${className}`}>+ // The wrapper IS the bar. Callers size it (`mt-4 -mb-4`, `w-full min-w-0+ // shrink-0`, `pb-px`), so those classes and the underline live here; the+ // strip keeps only what makes it the scroller. A select fallback hides this+ // whole bar below `sm` — hiding only the strip would leave an empty flex row+ // beside the select.+ const withArrows = (strip) => (scrollCue ? (+ <div className={`${selectFallback ? 'hidden sm:flex' : 'flex'} min-w-0 items-stretch ${variant === 'underline' ? 'border-b border-port-border' : ''} ${className}`}>{canScrollLeft && (<button type="button" onClick={() => scrollStrip(-1)} aria-label="Scroll tabs left" className={ARROW_CLASS}><ChevronLeft size={18} />@@ -224,8 +234,8 @@ export default function TabPills({{withArrows(<divref={stripRef}- onScroll={iconRow ? syncPosition : undefined}- className={`${selectFallback ? 'hidden sm:flex' : 'flex'} ${iconRow ? 'min-w-0 flex-1' : `shrink-0 ${className}`} items-center gap-1 bg-port-card border border-port-border rounded p-1 overflow-x-auto scrollbar-hide touch-pan-x`}+ onScroll={scrollCue ? syncPosition : undefined}+ className={`${selectFallback && !scrollCue ? 'hidden sm:flex' : 'flex'} ${scrollCue ? 'min-w-0 flex-1' : `shrink-0 ${className}`} items-center gap-1 bg-port-card border border-port-border rounded p-1 overflow-x-auto scrollbar-hide touch-pan-x`}role={isFilter ? 'group' : 'tablist'}aria-label={ariaLabel}>@@ -280,8 +290,8 @@ export default function TabPills({{withArrows(<divref={stripRef}- onScroll={iconRow ? syncPosition : undefined}- className={`${selectFallback ? 'hidden sm:flex' : 'flex'} ${iconRow ? 'min-w-0 flex-1' : `shrink-0 border-b border-port-border ${className}`} ${stretch ? 'items-stretch bg-port-bg/40' : 'gap-1'} overflow-x-auto scrollbar-hide touch-pan-x`}+ onScroll={scrollCue ? syncPosition : undefined}+ className={`flex min-w-0 flex-1 ${stretch ? 'items-stretch bg-port-bg/40' : 'gap-1'} overflow-x-auto scrollbar-hide touch-pan-x`}role="tablist"aria-label={ariaLabel}>diff --git a/client/src/components/ui/TabPills.test.jsx b/client/src/components/ui/TabPills.test.jsxindex 74d1a3e562..d26e965862 100644--- a/client/src/components/ui/TabPills.test.jsx+++ b/client/src/components/ui/TabPills.test.jsx@@ -218,6 +218,7 @@ describe('TabPills — mobileCompact icon row', () => {const rightArrow = screen.getByRole('button', { name: 'Scroll tabs right' });expect(rightArrow).toHaveClass('min-w-[44px]', 'min-h-[44px]');+ expect(rightArrow).not.toHaveClass('sm:hidden');await user.click(rightArrow);expect(scrollBy).toHaveBeenCalledWith({ left: 240, behavior });@@ -274,6 +275,130 @@ describe('TabPills — mobileCompact icon row', () => {});});+// A labelled strip (no mobileCompact) overflows the same way the icon row does.+// happy-dom is 0×0 and has no ResizeObserver, so the test states both.+describe('TabPills — desktop overflow chevrons', () => {+ function installResizeObserver() {+ const resize = [];+ const observed = [];+ vi.stubGlobal('ResizeObserver', class {+ constructor(cb) { resize.push(cb); }+ observe(node) { observed.push(node); }+ disconnect() {}+ });+ resize.observed = observed;+ return resize;+ }++ function publishOverflow(strip, { scrollWidth, clientWidth }) {+ Object.defineProperty(strip, 'scrollWidth', { configurable: true, value: scrollWidth });+ Object.defineProperty(strip, 'clientWidth', { configurable: true, value: clientWidth });+ }++ it.each(['underline', 'pills'])('shows a right chevron on an overflowing labelled %s strip and keeps the caller class on the bar', (variant) => {+ const resize = installResizeObserver();+ const { container } = render(+ <TabPills variant={variant} className="mt-4 -mb-4" tabs={sampleTabs} activeTab="cast" onChange={() => {}} />+ );+ const strip = container.querySelector('[role="tablist"]');+ publishOverflow(strip, { scrollWidth: 800, clientWidth: 300 });+ expect(screen.queryByRole('button', { name: 'Scroll tabs right' })).toBeNull();+ act(() => { for (const cb of resize) cb(); });++ const rightArrow = screen.getByRole('button', { name: 'Scroll tabs right' });+ expect(rightArrow).toHaveClass('min-w-[44px]', 'min-h-[44px]');+ expect(rightArrow).not.toHaveClass('sm:hidden');+ expect(screen.queryByRole('button', { name: 'Scroll tabs left' })).toBeNull();+ expect(within(screen.getByRole('tab', { name: /Cast/ })).getByText('Cast')).not.toHaveClass('max-sm:sr-only');++ const bar = strip.parentElement;+ expect(bar).toHaveClass('mt-4', '-mb-4', 'min-w-0');+ expect(strip).toHaveClass('min-w-0', 'flex-1');+ expect(strip).not.toHaveClass('mt-4');+ if (variant === 'underline') expect(bar).toHaveClass('border-b', 'border-port-border');+ else expect(strip).toHaveClass('bg-port-card');+ vi.unstubAllGlobals();+ });++ it('observes each tab so a wider label can reveal the chevron without the strip box changing', () => {+ const resize = installResizeObserver();+ const shortTabs = [+ { id: 'cast', label: 'Cast' },+ { id: 'places', label: 'Places' },+ ];+ const { container, rerender } = render(+ <TabPills tabs={shortTabs} activeTab="cast" onChange={() => {}} />+ );+ const strip = container.querySelector('[role="tablist"]');+ expect(resize.observed.some((node) => node !== strip && strip.contains(node))).toBe(true);++ publishOverflow(strip, { scrollWidth: 300, clientWidth: 300 });+ act(() => { for (const cb of resize) cb(); });+ expect(screen.queryByRole('button', { name: 'Scroll tabs right' })).toBeNull();++ rerender(+ <TabPills+ tabs={[{ id: 'cast', label: 'Cast and the rest of the row' }, shortTabs[1]]}+ activeTab="cast"+ onChange={() => {}}+ />+ );+ publishOverflow(strip, { scrollWidth: 800, clientWidth: 300 });+ act(() => { for (const cb of resize) cb(); });+ expect(screen.getByRole('button', { name: 'Scroll tabs right' })).toBeInTheDocument();+ vi.unstubAllGlobals();+ });++ it('shows no chevrons when the labelled strip fits', () => {+ const resize = installResizeObserver();+ const { container } = render(+ <TabPills tabs={sampleTabs} activeTab="cast" onChange={() => {}} />+ );+ publishOverflow(container.querySelector('[role="tablist"]'), { scrollWidth: 300, clientWidth: 300 });+ act(() => { for (const cb of resize) cb(); });+ expect(screen.queryByRole('button', { name: 'Scroll tabs right' })).toBeNull();+ expect(screen.queryByRole('button', { name: 'Scroll tabs left' })).toBeNull();+ vi.unstubAllGlobals();+ });++ it('scrolls a labelled strip from the chevrons', async () => {+ const resize = installResizeObserver();+ const user = userEvent.setup();+ const { container } = render(+ <TabPills tabs={sampleTabs} activeTab="cast" onChange={() => {}} />+ );+ const strip = container.querySelector('[role="tablist"]');+ publishOverflow(strip, { scrollWidth: 800, clientWidth: 300 });+ const scrollBy = vi.spyOn(strip, 'scrollBy').mockImplementation(() => {});+ act(() => { for (const cb of resize) cb(); });++ await user.click(screen.getByRole('button', { name: 'Scroll tabs right' }));+ expect(scrollBy).toHaveBeenCalledWith({ left: 240, behavior: 'smooth' });++ strip.scrollLeft = 200;+ fireEvent.scroll(strip);+ await user.click(screen.getByRole('button', { name: 'Scroll tabs left' }));+ expect(scrollBy).toHaveBeenLastCalledWith({ left: -240, behavior: 'smooth' });+ vi.unstubAllGlobals();+ });++ it('does not measure or chevron a filter chip row that overflows', () => {+ const resize = installResizeObserver();+ const { container } = render(+ <TabPills variant="filter" className="mt-2 max-w-full" tabs={sampleTabs} activeTab="cast" onChange={() => {}} ariaLabel="Filter by kind" />+ );+ const group = screen.getByRole('group', { name: 'Filter by kind' });+ expect(group).toBe(container.firstElementChild);+ expect(group).toHaveClass('mt-2', 'max-w-full');+ publishOverflow(group, { scrollWidth: 800, clientWidth: 300 });+ act(() => { for (const cb of resize) cb(); });+ expect(resize).toHaveLength(0);+ expect(screen.queryByRole('button', { name: 'Scroll tabs right' })).toBeNull();+ expect(within(group).getAllByRole('button')).toHaveLength(3);+ vi.unstubAllGlobals();+ });+});+describe('TabPills — runningKind', () => {it('swaps the icon for a spinner when a tab.runningKind matches the active runningKind', () => {const tabs = [diff --git a/client/src/pages/PipelineEditorialChecks.responsive.test.jsx b/client/src/pages/PipelineEditorialChecks.responsive.test.jsxindex 6ff7923fdd..8e8e0ac1ba 100644--- a/client/src/pages/PipelineEditorialChecks.responsive.test.jsx+++ b/client/src/pages/PipelineEditorialChecks.responsive.test.jsx@@ -70,8 +70,9 @@ describe('PipelineEditorialChecks responsive switch (#1611)', () => {const tablist = await screen.findByRole('tablist', { name: /editorial sections/i });// The switch (a shared TabPills) is wrapped in an `lg:hidden` div so it only- // appears below the breakpoint where the two columns stack.- expect(tablist.parentElement).toHaveClass('lg:hidden');+ // appears below the breakpoint where the two columns stack. The scroll bar+ // sits between the tablist and that div.+ expect(tablist.closest('.lg\\:hidden')).toHaveClass('lg:hidden');const catalogTab = screen.getByRole('tab', { name: 'Catalog' });const findingsTab = screen.getByRole('tab', { name: 'Findings' });diff --git a/client/src/pages/VideoTimelineEditor.test.jsx b/client/src/pages/VideoTimelineEditor.test.jsxindex efc1fa284b..6cdb880223 100644--- a/client/src/pages/VideoTimelineEditor.test.jsx+++ b/client/src/pages/VideoTimelineEditor.test.jsx@@ -389,7 +389,8 @@ describe('workspace layout — mobile library regression (#5424)', () => {fireEvent.click(showLibrary);- const library = screen.getByRole('tablist', { name: 'Clip library' }).parentElement;+ // The scroll bar sits between the tablist and the panel the page sizes.+ const library = screen.getByRole('tablist', { name: 'Clip library' }).closest('#timeline-library');expect(screen.getByRole('button', { name: 'Hide library' })).toBeInTheDocument();expect(screen.getByRole('button', { name: 'Hide library' })).toHaveAttribute('aria-expanded', 'true');expect(workspace?.parentElement).toHaveClass('lg:grid-cols-[260px_1fr_240px]');@@ -405,13 +406,13 @@ describe('workspace layout — mobile library regression (#5424)', () => {const mountedLibrary = library;Object.defineProperty(window, 'innerWidth', { configurable: true, value: 1024 });fireEvent(window, new Event('resize'));- expect(screen.getByRole('tablist', { name: 'Clip library' }).parentElement).toBe(mountedLibrary);+ expect(screen.getByRole('tablist', { name: 'Clip library' }).closest('#timeline-library')).toBe(mountedLibrary);});it('keeps the desktop library visible in the original left-rail grid position', async () => {await renderEditor();- const library = screen.getByRole('tablist', { name: 'Clip library' }).parentElement;+ const library = screen.getByRole('tablist', { name: 'Clip library' }).closest('#timeline-library');const workspace = screen.getByRole('button', { name: 'Play' }).parentElement?.parentElement;expect(screen.getByRole('button', { name: 'Hide library' })).toBeInTheDocument();expect(workspace?.parentElement).toHaveClass('lg:grid-cols-[260px_1fr_240px]');