A drop of text or files inside a tab leaves the next tab drag without an overlay or drop outline
Describe the bug
After anything that is not a tab is dropped inside the layout, for instance text dragged from one input to another inside a tab, the next tab drag shows no overlay, no drop outline and no edge markers. The drop itself still lands, but the user gets no feedback on the way. Where tab content stops dragover from bubbling (a code editor, say), the layout cannot follow the pointer over it either, since there is no overlay on top.
Your Example Website or App
The component in the steps below; no hosted copy.
Steps to Reproduce the Bug or Issue
- Render this component:
import { Layout, Model, TabNode } from "flexlayout-react";
import "flexlayout-react/style/light.css";
// Two panes; the left one holds two text fields.
const model = Model.fromJson({
global: {},
borders: [],
layout: {
type: "row",
children: [
{ type: "tabset", children: [{ type: "tab", name: "Form", component: "form" }] },
{ type: "tabset", children: [{ type: "tab", name: "Other", component: "text" }] },
],
},
});
function factory(node: TabNode) {
return node.getComponent() === "form" ? (
<div style={{ padding: 16 }}>
<input defaultValue="drag me" /> <input />
</div>
) : (
<div style={{ padding: 16 }}>{node.getName()}</div>
);
}
export default function App() {
return (
<div style={{ position: "absolute", inset: 0 }}>
<Layout model={model} factory={factory} />
</div>
);
}
- In the Form pane, select the text of the first input ("drag me") and drag it into the second input. The text moves.
- Drag the "Other" tab over the Form pane.
Expected behavior
The overlay, the drop outline and the four edge markers show while the tab is over the pane, as they do when step 2 is skipped.
Operating System
Windows 10 (10.0.19045)
Browser Type?
Chromium (the build that comes with Playwright 1.63; other browsers not tried)
Browser Version
153.0.8010.12
Screenshots or Videos
None. What the page holds during the drag in step 3:
- step 2 skipped:
.flexlayout__layout_overlayhasdisplay: flex, there is a.flexlayout__outline_rect, and there are 4.flexlayout__edge_rect - after step 2:
display: none, no outline, no edge rects
Additional context
flexlayout-react 0.11.0, React 18.3.1.
DragDropManager.onDragEnterRaw counts every drag that enters the layout, and updateActive sets _active without looking at dragState. onDrop returns early when the drag is not the layout's own (src/view/layout/DragDropManager.tsx:400), before this._dragEnterCount = 0 at its end (line 438), and after a drop the browser sends no dragleave, so _active stays true. The next setDragNode resets the count but not _active, so setActive(true) does nothing and onDragEnter, which creates the outline and shows the overlay, never runs.
Clearing the local drag state before that early return fixes it. I checked this against the steps above with the same change made to a copy of dist/index.js:
onDrop = (event: React.DragEvent<HTMLElement>) => {
if (this._mainController !== DragDropManager.dragState?.mainLayoutController) {
+ this.clearDragLocal();
return;
}
fixed in 0.11.1