fix(tabs): keep unused tab-strip space draggable when tabs do not overflow

This commit is contained in:
陈大猫 committed 2026-11-12 19:41:14 +08:00
1 parent de05276613
commit cfb634c5bd
2 files changed
+5 -4

No files matched your search

+2 -2
View File
@@ -69,7 +69,7 @@ test("top tab native exclusions stay bounded to the stationary scroll viewport",
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.match(viewport[0], /className="[^"]*\bflex-1\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.
@@ -80,7 +80,7 @@ test("top tab native exclusions stay bounded to the stationary scroll viewport",
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="min-w-\[20px\] h-7 app-drag flex-shrink-0 self-end" style=\{dragRegionStyle\} \/>/);
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");
+3 -2
View File
@@ -1157,7 +1157,7 @@ const TopTabsInner: React.FC<TopTabsProps> = ({
{/* Scrollable container */}
<div
ref={tabsContainerRef}
className="top-tab-scroll-viewport min-w-0 flex-1 flex items-end gap-0 overflow-x-auto scrollbar-none app-no-drag max-w-full"
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) => {
@@ -1188,7 +1188,8 @@ const TopTabsInner: React.FC<TopTabsProps> = ({
</Tooltip>
)}
</div>
{/* Keep the drag handle outside the scroll viewport's exclusion. */}
{/* 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 */}