Compare commits

...
Author SHA1 Message Date
陈大猫 cfb634c5bd fix(tabs): keep unused tab-strip space draggable when tabs do not overflow 2026-11-12 19:41:14 +08:00
陈大猫 de05276613 fix(tabs): stop overflowed top tabs from stealing titlebar drag regions
Keep the native no-drag exclusion on the stationary scroll viewport, neutralize scrolled descendant regions, and move the 20 px drag handle outside the viewport. Add a source-level regression for the region policy.

Related #4220. Addresses bug 2 only; the split-pane blanking bug remains unresolved.
2026-11-12 19:35:04 +08:00
3 changed files with 39 additions and 4 deletions

No files matched your search

+26
View File
@@ -64,6 +64,32 @@ test("host tree tab gutter never goes negative", () => {
assert.equal(computeHostTreeTabGutter(120, 280), 0);
});
test("top tab native exclusions stay bounded to the stationary scroll viewport", () => {
const viewport = topTabsSource.match(/<div\s+ref=\{tabsContainerRef\}[\s\S]*?onClick=/);
assert.ok(viewport, "expected the tab scroll viewport");
assert.match(viewport[0], /className="[^"]*\btop-tab-scroll-viewport\b[^"]*"/);
assert.match(viewport[0], /className="[^"]*\bmin-w-0\b[^"]*"/);
assert.doesNotMatch(viewport[0], /className="[^"]*\bflex-1\b[^"]*"/);
assert.match(viewport[0], /className="[^"]*\boverflow-x-auto\b[^"]*\bapp-no-drag\b[^"]*"/);
assert.doesNotMatch(viewport[0], /\bapp-drag\b/);
// Inline no-drag keeps the viewport excluded despite the scoped CSS reset.
assert.match(viewport[0], /style=\{\{[^}]*\.\.\.noDragRegionStyle\s*\}\}/);
assert.match(topTabsSource, /const noDragRegionStyle = \{ WebkitAppRegion: 'no-drag' \}/);
const scrollContent = topTabsSource.slice(topTabsSource.indexOf(viewport[0]));
const viewportEnd = scrollContent.indexOf("</div>");
assert.match(scrollContent.slice(0, viewportEnd), /\{renderOrderedTabs\(\)\}/);
assert.doesNotMatch(scrollContent.slice(0, viewportEnd), /min-w-\[20px\]/);
assert.match(scrollContent.slice(viewportEnd), /^<\/div>\s*\{\/\*[^}]*\*\/\}\s*<div className="flex-1 app-drag" style=\{dragRegionStyle\} \/>\s*<div className="min-w-\[20px\] h-7 app-drag flex-shrink-0 self-end" style=\{dragRegionStyle\} \/>/);
const regionReset = indexCss.match(/\.top-tab-scroll-viewport,\s*\.top-tab-scroll-viewport \*\s*\{([^}]+)\}/);
assert.ok(regionReset, "expected a native region reset for the viewport and every descendant");
assert.match(regionReset[1], /-webkit-app-region:\s*none;/);
assert.match(regionReset[1], /(?:^|[;\s])app-region:\s*none;/);
assert.ok(indexCss.indexOf(regionReset[0]) > indexCss.indexOf(".app-no-drag * {"));
assert.match(topTabItemsSource, /netcatty-tab[^\n]*\bapp-no-drag\b/);
});
test("host tree tab surface stays mounted when root pages are active", () => {
assert.equal(shouldKeepHostTreeToggleSurface({
enabled: true,
+5 -4
View File
@@ -1157,8 +1157,8 @@ const TopTabsInner: React.FC<TopTabsProps> = ({
{/* Scrollable container */}
<div
ref={tabsContainerRef}
className="flex items-end gap-0 overflow-x-auto scrollbar-none app-drag max-w-full"
style={{ scrollbarWidth: 'none', msOverflowStyle: 'none' }}
className="top-tab-scroll-viewport min-w-0 flex items-end gap-0 overflow-x-auto scrollbar-none app-no-drag max-w-full"
style={{ scrollbarWidth: 'none', msOverflowStyle: 'none', ...noDragRegionStyle }}
onClick={handleScrollableTabClick}
onDragOver={(e) => {
if (hasWorkspaceSessionDrag(e.dataTransfer)) {
@@ -1187,9 +1187,10 @@ const TopTabsInner: React.FC<TopTabsProps> = ({
<TooltipContent>{t('topTabs.openQuickSwitcher')}</TooltipContent>
</Tooltip>
)}
{/* Draggable spacer - fixed width handle at the end */}
<div className="min-w-[20px] h-7 app-drag flex-shrink-0" style={dragRegionStyle} />
</div>
{/* Keep unused space and the drag handle outside the scroll viewport's exclusion. */}
<div className="flex-1 app-drag" style={dragRegionStyle} />
<div className="min-w-[20px] h-7 app-drag flex-shrink-0 self-end" style={dragRegionStyle} />
{/* Right fade mask */}
{canScrollRight && (
+8
View File
@@ -820,6 +820,14 @@ html[data-theme-transition] *::after {
-webkit-user-select: auto;
}
/* Scrolled boxes export native regions beyond their scroll clip. Only the
stationary viewport contributes an exclusion via its inline no-drag style. */
.top-tab-scroll-viewport,
.top-tab-scroll-viewport * {
-webkit-app-region: none;
app-region: none;
}
/* Selected top-tab hooks. Fill and text stay on the tab's inline style so the
unset custom properties fall through to the existing chrome colors. The
border is a 1px inset outline and stays invisible until