fix(tabs): no drag while a rail search is active (#580)

From the owner's review of #580 rather than the bot's report: "Drag
while searching: I'd turn it off. A drop is saved for every device
(session order or the tab layout), and where it lands relative to the
rows the search is hiding is something you only see after clearing it."
The PR head left drag on.

Both rail drags now refuse while the search narrows the list: the
grouped rail's pointer drag in _onTabLayoutPointerDown(), and the flat
manual rail's HTML5 drag in its dragstart listener. The flat rail is
refused in the listener, not by flipping `draggable`, because a
keystroke in the box does not re-render the rows, so a cleared search
drags again with the same rows. The sidebar filter box, the header strip
and the keyboard moves (Ctrl+Shift+{ }, the row menu) are unchanged.

Tests: a grouped-rail press during a search starts no drag and one after
clearing does; a flat-rail dragstart during a search is refused and one
after clearing goes through. CLAUDE.md and the Dashboard wiki row say
so.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer
2026-10-10 04:10:05 +02:00
parent 4a94eb9ba7
commit 183efacc93
4 changed files with 68 additions and 2 deletions
+11
View File
@@ -8006,6 +8006,9 @@ class CodemanApp {
if (this._tabLayoutDrag) this._cancelTabLayoutPointerDrag(container);
if (e.button !== 0 || e.pointerType === 'touch' || !container.classList.contains('session-tabs--grouped')) return;
if (this._inlineRenameActive || !this._tabLayoutEditable()) return;
// No drag while the rail search narrows the list: a drop is saved for every
// device, relative to rows the search is hiding (owner's call on #580).
if (this._tabRailSearchActive()) return;
// Controls keep their own click; only the row body or the header drags.
if (e.target.closest('.tab-actions, .tab-badge, .tab-layout-group-menu, button, input, [onclick*="stopPropagation"]')) return;
const header = e.target.closest('[data-tab-group-header]');
@@ -8223,6 +8226,14 @@ class CodemanApp {
tab.setAttribute('draggable', 'true');
tab.addEventListener('dragstart', (e) => {
// No drag while the rail search narrows the list: the drop rewrites the
// order every device sees, relative to rows the search is hiding
// (owner's call on #580). Refused here rather than by `draggable`,
// because a keystroke in the box does not re-render the rows.
if (this._tabRailSearchActive()) {
e.preventDefault();
return;
}
this.draggedTabId = tab.dataset.id;
tab.classList.add('dragging');
e.dataTransfer.effectAllowed = 'move';