Skip to content

Build your personal knowledge base with Trilium Notes

client/collections/board: fix an issue

Adorian Doran60e952680224
diff --git a/apps/client/src/widgets/collections/board/column.tsx b/apps/client/src/widgets/collections/board/column.tsx
index 2755e6eebc..57f692880a 100644
--- a/apps/client/src/widgets/collections/board/column.tsx
+++ b/apps/client/src/widgets/collections/board/column.tsx
@@ -598,6 +598,9 @@ export default function Column({
data-column={column}
// Read by the drag, which offers neither end of a column that places its own cards.
data-sorted={isSorted ? "true" : undefined}
+ // Also read by the drag, for placing a card at the column's foot. On the column rather
+ // than on the card area below, which a collapsed column does not draw at all.
+ data-count={noteIds.length}
className={clsx("board-column", {
"drag-over": isDropTarget && (isSorted || draggedCard?.fromColumn !== column),
// The class the themes key a hue off, worn here as anywhere else that carries one.
@@ -729,7 +732,6 @@ export default function Column({
className={clsx("board-column-content", scrollFade.className)}
style={scrollFade.style}
onWheel={handleScroll}
- data-count={noteIds.length}
data-window-from={isWindowed ? windowFrom : undefined}
data-window-count={isWindowed ? noteIds.length : undefined}
>
diff --git a/apps/client/src/widgets/collections/board/index.spec.tsx b/apps/client/src/widgets/collections/board/index.spec.tsx
index a5e0f0a72a..9e75cf0e26 100644
--- a/apps/client/src/widgets/collections/board/index.spec.tsx
+++ b/apps/client/src/widgets/collections/board/index.spec.tsx
@@ -4312,6 +4312,20 @@ describe("a column windowed for its size", () => {
.toBeUndefined();
});
+ /**
+ * The drag places a card at a column's foot by this count. It has to stand on the column
+ * itself: a collapsed column draws no card area to hang it off, and a windowed one draws fewer
+ * cards than it holds.
+ */
+ it("says on each column how many cards it holds, drawn or not", async () => {
+ const board = await renderSized(200, 3);
+ const columns = board.querySelectorAll<HTMLElement>(".board-column");
+
+ expect(columns[0].dataset.count).toBe("200");
+ expect(columns[0].querySelectorAll(".board-note").length).toBeLessThan(200);
+ expect(columns[1].dataset.count).toBe("3");
+ });
+
/**
* The drag and the keyboard both name a card by the place it holds in its column. Counting
* drawn elements would name a place among whatever is on screen, which moves as it scrolls.