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 (simplify): make Drawer's mobile <select> actually render + unify body div

[._.]/ Adam Eivy8ec9d9f6509d
diff --git a/client/src/components/Drawer.jsx b/client/src/components/Drawer.jsx
index 4af0370092..1d9acd98ac 100644
--- a/client/src/components/Drawer.jsx
+++ b/client/src/components/Drawer.jsx
@@ -94,6 +94,11 @@ export default function Drawer({
</button>
</header>
{hasTabs && (
+ // Element ids below assume one drawer is open at a time — true by the
+ // modal contract (backdrop + scroll-lock), and a closed drawer renders
+ // nothing (`if (!open) return null`). Two drawers on one page use
+ // distinct URL params (useDrawerTab) for their persisted tab state, but
+ // never share the DOM open simultaneously, so the ids can't collide.
<div className="px-4 pt-3 shrink-0 border-b border-port-border">
<TabPills
tabs={tabList}
@@ -106,23 +111,20 @@ export default function Drawer({
/>
</div>
)}
- {hasTabs ? (
- // key on the tab id so switching tabs remounts the panel and resets its
- // scroll position — no single accumulated page-length scroll.
- <div
- key={currentTab}
- id={`drawer-tabpanel-${currentTab}`}
- role="tabpanel"
- aria-labelledby={`tab-${currentTab}`}
- className={bodyClasses}
- >
- {children}
- </div>
- ) : (
- <div className={bodyClasses}>
- {children}
- </div>
- )}
+ {/* One body element for both modes. When tabbed, `key={currentTab}`
+ remounts the panel on switch so each tab's scroll resets — no single
+ accumulated page-length scroll. */}
+ <div
+ key={hasTabs ? currentTab : undefined}
+ {...(hasTabs && {
+ id: `drawer-tabpanel-${currentTab}`,
+ role: 'tabpanel',
+ 'aria-labelledby': `tab-${currentTab}`,
+ })}
+ className={bodyClasses}
+ >
+ {children}
+ </div>
</aside>
</>
);
diff --git a/client/src/components/Drawer.test.jsx b/client/src/components/Drawer.test.jsx
index 2f4300d46a..ff13f6e1ab 100644
--- a/client/src/components/Drawer.test.jsx
+++ b/client/src/components/Drawer.test.jsx
@@ -91,6 +91,16 @@ describe('Drawer', () => {
expect(screen.getByRole('tabpanel')).toHaveAttribute('id', 'drawer-tabpanel-jira');
});
+ it('renders the mobile <select> fallback for tabbed drawers', () => {
+ // The drawer uses the default underline variant; the mobile <select>
+ // collapse must still render (regression guard for the variant-agnostic
+ // mobileDropdown wiring).
+ render(<Drawer open onClose={() => {}} title="X" tabs={TABS} activeTab="ports" onTabChange={() => {}}>body</Drawer>);
+ const select = screen.getByRole('combobox');
+ expect(select).toHaveAttribute('id', 'drawer-tab-select');
+ expect(select).toHaveValue('ports');
+ });
+
it('is controllable via activeTab + onTabChange', () => {
const onTabChange = vi.fn();
const { rerender } = render(
diff --git a/client/src/components/ui/TabPills.jsx b/client/src/components/ui/TabPills.jsx
index a2baddff89..79de9a8aee 100644
--- a/client/src/components/ui/TabPills.jsx
+++ b/client/src/components/ui/TabPills.jsx
@@ -35,27 +35,31 @@ export default function TabPills({
const sz = SIZE[size] || SIZE.md;
const visibleTabs = tabs.filter(Boolean);
+ // Mobile `<select>` collapse, shared by both variants so `mobileDropdown` works
+ // regardless of `variant` (the underline tab bar just overflow-scrolls without it).
+ const mobileSelect = mobileDropdown ? (
+ <div className="sm:hidden">
+ {mobileSelectId && <label htmlFor={mobileSelectId} className="sr-only">{ariaLabel || 'Section'}</label>}
+ <select
+ id={mobileSelectId}
+ value={activeTab}
+ onChange={(e) => onChange(e.target.value)}
+ aria-label={mobileSelectId ? undefined : (ariaLabel || 'Section')}
+ className="w-full bg-port-card border border-port-border rounded px-3 py-2 text-white text-sm focus:outline-none focus:border-port-accent min-h-[40px]"
+ >
+ {visibleTabs.map((t) => (
+ <option key={t.id} value={t.id}>
+ {t.label}{t.count != null && t.count > 0 ? ` (${t.count})` : ''}
+ </option>
+ ))}
+ </select>
+ </div>
+ ) : null;
+
if (variant === 'pills') {
return (
<>
- {mobileDropdown && (
- <div className="sm:hidden">
- {mobileSelectId && <label htmlFor={mobileSelectId} className="sr-only">{ariaLabel || 'Section'}</label>}
- <select
- id={mobileSelectId}
- value={activeTab}
- onChange={(e) => onChange(e.target.value)}
- aria-label={mobileSelectId ? undefined : (ariaLabel || 'Section')}
- className="w-full bg-port-card border border-port-border rounded px-3 py-2 text-white text-sm focus:outline-none focus:border-port-accent min-h-[40px]"
- >
- {visibleTabs.map((t) => (
- <option key={t.id} value={t.id}>
- {t.label}{t.count != null && t.count > 0 ? ` (${t.count})` : ''}
- </option>
- ))}
- </select>
- </div>
- )}
+ {mobileSelect}
<div
ref={listRef}
onScroll={onScroll}
@@ -103,13 +107,15 @@ export default function TabPills({
// underline variant
return (
- <div
- ref={listRef}
- onScroll={onScroll}
- className={`flex shrink-0 border-b border-port-border ${stretch ? 'items-stretch bg-port-bg/40' : 'gap-1'} overflow-x-auto scrollbar-hide touch-pan-x ${className}`}
- role="tablist"
- aria-label={ariaLabel}
- >
+ <>
+ {mobileSelect}
+ <div
+ ref={listRef}
+ onScroll={onScroll}
+ className={`${mobileDropdown ? 'hidden sm:flex' : 'flex'} shrink-0 border-b border-port-border ${stretch ? 'items-stretch bg-port-bg/40' : 'gap-1'} overflow-x-auto scrollbar-hide touch-pan-x ${className}`}
+ role="tablist"
+ aria-label={ariaLabel}
+ >
{visibleTabs.map((t) => {
const Icon = t.icon;
const active = t.id === activeTab;
@@ -153,6 +159,7 @@ export default function TabPills({
</button>
);
})}
- </div>
+ </div>
+ </>
);
}