From 55bffbe3509b3a5ccf4f7d207fe2d51e7b4b99fb Mon Sep 17 00:00:00 2001 From: LucasDLTG Date: Tue, 28 Jul 2026 22:53:43 +0200 Subject: [PATCH] fix: illegal button inside button is header --- src/components/topbar/Topbar.css | 34 ++++++++++----- src/components/topbar/Topbar.tsx | 74 +++++++++++++++----------------- 2 files changed, 58 insertions(+), 50 deletions(-) diff --git a/src/components/topbar/Topbar.css b/src/components/topbar/Topbar.css index 6e23dc9..7b50393 100644 --- a/src/components/topbar/Topbar.css +++ b/src/components/topbar/Topbar.css @@ -134,11 +134,12 @@ gap: var(--space-3); height: var(--tab-height); padding: 0 var(--space-3); - border: var(--border-width-active) solid transparent; + border: var(--border-width-active) solid var(--border-hairline); border-radius: var(--radius-lg); background: transparent; color: var(--text-muted); font-family: var(--font-ui); + font-size: var(--font-md); cursor: pointer; box-sizing: border-box; scroll-snap-align: start; @@ -157,15 +158,19 @@ border-color: var(--accent-brand); } -.tab span[title] { +.tab-name { + flex: 1 1 auto; + min-width: 0; + overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - min-width: 0; + + user-select: none; } .tab-led { - height: 40%; + height: 50%; aspect-ratio: 1 / 1; flex: 0 0 auto; @@ -174,26 +179,33 @@ align-items: center; justify-content: center; - min-height: 0; - min-width: 0; - + border: 0; border-radius: var(--radius-sm); + + background: transparent; + + padding: 0; } .tab-close { height: 50%; aspect-ratio: 1 / 1; + flex: 0 0 auto; + display: flex; align-items: center; justify-content: center; - flex: 0 0 auto; + + border: 0; + border-radius: var(--radius-sm); + margin-left: auto; padding: 0; font-size: var(--tab-close-font); - line-height: 1; color: var(--text-muted); - border-radius: var(--radius-sm); + + background: transparent; } .tab--active { @@ -249,4 +261,4 @@ (var(--space-3) * 2) + (var(--tab-height) * 0.5) + (var(--space-2) * 2) + 4ch + var(--tab-close-size) ); -} +} \ No newline at end of file diff --git a/src/components/topbar/Topbar.tsx b/src/components/topbar/Topbar.tsx index 8fea3f6..f552430 100644 --- a/src/components/topbar/Topbar.tsx +++ b/src/components/topbar/Topbar.tsx @@ -34,72 +34,68 @@ function Tab({ onConnect: (dsp: DSP) => void; onDisconnect: (dsp: DSP) => void; }) { - const handleLedClick = (e: React.MouseEvent) => { - e.stopPropagation(); + const isConnected = dsp.status === 'connected'; - if (dsp.status === 'connected') { - onDisconnect(dsp); - } else { - onConnect(dsp); + const handleTabKeyDown = (e: React.KeyboardEvent) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + onSelect(); } }; return ( - {dsp.name} - { e.stopPropagation(); onRemove(); }} - onKeyDown={(e) => { - if (e.key === 'Enter' || e.key === ' ') { - e.preventDefault(); - e.stopPropagation(); - onRemove(); - } - }} > - - + + ); }