Skip to content

Build your personal knowledge base with Trilium Notes

client/collections/board: fix some issues

Adorian Doranfbeaff2456d3
diff --git a/apps/client/src/widgets/collections/board/board_drag.ts b/apps/client/src/widgets/collections/board/board_drag.ts
index fafb8b2b19..54a927e2a6 100644
--- a/apps/client/src/widgets/collections/board/board_drag.ts
+++ b/apps/client/src/widgets/collections/board/board_drag.ts
@@ -150,7 +150,20 @@ export function useBoardDrag(
// Held from here on, so the gesture keeps the pointer wherever it goes. Taken at the
// press instead, it would carry the click away from what was pressed.
container.setPointerCapture?.(held.pointerId);
+
+ // Taking the card out of the flow shortens its column, and a column scrolled near its
+ // foot is clamped to the new end before the gap standing in for the card has been
+ // drawn. Put back on the next frame, by which time it has.
+ const area = held.element.closest<HTMLElement>(".board-column-content");
+ const keptScroll = area?.scrollTop;
const lifted = lift(held, container);
+ if (area && keptScroll !== undefined) {
+ requestAnimationFrame(() => {
+ if (area.scrollTop < keptScroll) {
+ area.scrollTop = keptScroll;
+ }
+ });
+ }
held.preview = lifted.preview;
held.grab = lifted.grab;
container.classList.add("board-dragging");
diff --git a/apps/client/src/widgets/collections/board/index.css b/apps/client/src/widgets/collections/board/index.css
index 9bbbc83770..4a9b318b8d 100644
--- a/apps/client/src/widgets/collections/board/index.css
+++ b/apps/client/src/widgets/collections/board/index.css
@@ -434,6 +434,14 @@ body.mobile .board-view-container .board-add-column {
touch-action: none;
}
+/* The gap opening and closing moves content above whatever the browser has anchored to, and it
+ shifts the column to keep that still. The shift moves the card under the pointer, which moves the
+ gap, which shifts the column again: at the foot of a tall column the two chase each other and it
+ never settles on the last place. */
+.board-view-container.board-dragging .board-column-content {
+ overflow-anchor: none;
+}
+
/* A long press on a card is how it is picked up, not how it is selected or looked up. */
.board-view-container .board-note {
-webkit-touch-callout: none;