Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/collections/board: allow the items to be moved across columns from the top level of the context menu, instead of a sub menu
Adorian Dorandd5180916743
diff --git a/apps/client/src/menus/context_menu.ts b/apps/client/src/menus/context_menu.tsindex 88ce6c311d..07d0c4c9a0 100644--- a/apps/client/src/menus/context_menu.ts+++ b/apps/client/src/menus/context_menu.ts@@ -62,6 +62,15 @@ export interface MenuCommandItem<T> {keyboardShortcut?: KeyboardActionNames;spellingSuggestion?: string;checked?: boolean;+ /** Classes put on the item itself, for a menu styling one of its entries differently. */+ className?: string;+ /**+ * An icon shown at the trailing edge of the item, where a shortcut would go.+ *+ * Unlike {@link checked}, which takes the place of {@link uiIcon}, this leaves the item's own+ * icon standing — for a list where that icon is what tells one entry from another.+ */+ trailingIcon?: string;columns?: number;}@@ -345,8 +354,14 @@ class ContextMenu {$link.append($("<kbd>").text(item.shortcut));}+ if ("trailingIcon" in item && item.trailingIcon) {+ $link.append($("<span>")+ .addClass([ item.trailingIcon, "tn-icon", "menu-trailing-icon" ]));+ }+const $item = $("<li>").addClass("dropdown-item")+ .addClass("className" in item ? item.className ?? "" : "").append($link).on("contextmenu", (e) => false)// important to use mousedown instead of click since the former does not change focusdiff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.cssindex 9c1dd20559..980fddd4b6 100644--- a/apps/client/src/stylesheets/style.css+++ b/apps/client/src/stylesheets/style.css@@ -548,6 +548,7 @@ body.mobile .dropdown .dropdown-submenu {}.dropdown-item span.keyboard-shortcut,+.dropdown-item span.menu-trailing-icon,.dropdown-item *:not(.keyboard-shortcut) > kbd {flex-grow: 1;text-align: end;diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 9faf316c69..79a8035414 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -3347,7 +3347,7 @@"remove-from-board": "Remove from board","archive-note": "Archive note","unarchive-note": "Unarchive note",- "move-to": "Move to",+ "status-header": "Status","duplicate-item": "Duplicate","insert-above": "Insert above","insert-below": "Insert below",diff --git a/apps/client/src/widgets/collections/board/api.spec.ts b/apps/client/src/widgets/collections/board/api.spec.tsindex 84bf7513bb..71a5feaa18 100644--- a/apps/client/src/widgets/collections/board/api.spec.ts+++ b/apps/client/src/widgets/collections/board/api.spec.ts@@ -960,3 +960,36 @@ describe("duplicating a card", () => {expect(branches.moveAfterBranch).toHaveBeenCalledWith([ "copyBranch" ], "card1Branch");});});++describe("what the board calls the field it groups by", () => {+ it("uses the promoted alias, and the stock word where the definition gives none", () => {+ const named = buildNote({+ title: "Board",+ "#collection": "",+ "#viewType": "board",+ "#label:status": "promoted,alias=Stage,single,select,options=To Do"+ });+ const bare = buildNote({+ title: "Board",+ "#collection": "",+ "#viewType": "board",+ "#label:status": "promoted,single,select,options=To Do"+ });++ expect(createApi({}, [], named).api.getStatusLabel()).toBe("Stage");+ // i18next is never initialised under test, so the fallback comes back as its key.+ expect(createApi({}, [], bare).api.getStatusLabel()).toBe("board_view.status-header");+ });++ /** Handed back by the parser for a bare , which names nothing. */+ it("falls back where the alias is empty", () => {+ const empty = buildNote({+ title: "Board",+ "#collection": "",+ "#viewType": "board",+ "#label:status": "promoted,alias=,single,select,options=To Do"+ });++ expect(createApi({}, [], empty).api.getStatusLabel()).toBe("board_view.status-header");+ });+});diff --git a/apps/client/src/widgets/collections/board/api.ts b/apps/client/src/widgets/collections/board/api.tsindex 9922214493..8b3d850444 100644--- a/apps/client/src/widgets/collections/board/api.ts+++ b/apps/client/src/widgets/collections/board/api.ts@@ -308,6 +308,16 @@ export default class BoardApi {return cssClassManager.createClassForColor(color ?? null);}+ /**+ * What to call the field the board groups by, for a heading standing over its columns.+ *+ * The promoted alias is what a card shows the field as, so it is the name a reader already+ * knows. A board whose definition gives none, or none of its own, falls back to the stock word.+ */+ getStatusLabel() {+ return this.statusDefinition?.definition.promotedAlias || t("board_view.status-header");+ }+/** Whether a column is archived, which the board shows only while archived notes are shown. */isColumnArchived(column: string) {return !!this.viewConfig?.columns?.find(col => col.value === column)?.archived;diff --git a/apps/client/src/widgets/collections/board/card.tsx b/apps/client/src/widgets/collections/board/card.tsxindex ed81e10f3c..46dfe86af6 100644--- a/apps/client/src/widgets/collections/board/card.tsx+++ b/apps/client/src/widgets/collections/board/card.tsx@@ -26,7 +26,8 @@ function Card({column,index,isDragging,- isEditing+ isEditing,+ onFocusCard}: {api: BoardApi,note: FNote,@@ -38,7 +39,9 @@ function Card({* Passed down rather than derived here from the drag state's `branchIdToEdit`, so that a card* subscribes only to the board's stable context and a drag leaves it off the render path.*/- isEditing: boolean+ isEditing: boolean,+ /** Puts focus back on this card once a change of column has drawn it under another one. */+ onFocusCard: (noteId: string) => void}) {const { setBranchIdToEdit, setDraggedCard } = useContext(BoardActionsContext);const colorClass = note.getColorClass() || '';@@ -70,8 +73,8 @@ function Card({}, [setDraggedCard]);const handleContextMenu = useCallback((e: ContextMenuEvent) => {- openNoteContextMenu(api, e, note, branch.branchId, column);- }, [ api, note, branch, column ]);+ openNoteContextMenu(api, e, note, branch.branchId, column, onFocusCard);+ }, [ api, note, branch, column, onFocusCard ]);const handleOpen = useCallback((e: MouseEvent) => {// A double click is one gesture, and its second click would open the note over itself: thediff --git a/apps/client/src/widgets/collections/board/column.tsx b/apps/client/src/widgets/collections/board/column.tsxindex 00864f4025..28e2af1cae 100644--- a/apps/client/src/widgets/collections/board/column.tsx+++ b/apps/client/src/widgets/collections/board/column.tsx@@ -35,6 +35,7 @@ export default function Column({columns,onMoveColumn,onFocusColumn,+ onFocusCard,icon,color,archived,@@ -63,7 +64,8 @@ export default function Column({columns: string[],/** Moves a column to sit before the given position, as a drag onto that position would. */onMoveColumn: (fromIndex: number, toIndex: number) => void,- onFocusColumn: (column: string) => void+ onFocusColumn: (column: string) => void,+ onFocusCard: (noteId: string) => void} & DragContext) {const [ isVisible, setVisible ] = useState(true);const [ isCreatingNewItem, setIsCreatingNewItem ] = useState(false);@@ -225,6 +227,7 @@ export default function Column({index={index}isDragging={draggedCard?.noteId === note.noteId}isEditing={branch.branchId === branchIdToEdit}+ onFocusCard={onFocusCard}/></Fragment>);diff --git a/apps/client/src/widgets/collections/board/context_menu.spec.ts b/apps/client/src/widgets/collections/board/context_menu.spec.tsindex 0e5e2cd979..fa58a21e97 100644--- a/apps/client/src/widgets/collections/board/context_menu.spec.ts+++ b/apps/client/src/widgets/collections/board/context_menu.spec.ts@@ -279,26 +279,22 @@ describe("Board item context menu", () => {.toEqual([ "before", "after" ]);});- it("moves the card to the column picked, leaving the one it is in unselectable", () => {+ it("copies a card into the board, after the one it was made from", async () => {const api = {- columns: [ "To Do", "Done" ],+ columns: [ "To Do" ],isColumnArchived: () => false,getColumnIcon: () => DEFAULT_COLUMN_ICON,getColumnColorClass: () => "",- changeColumn: vi.fn(async () => {})+ duplicateItem: vi.fn(async () => {})} as unknown as BoardApi;- const moveTo = openItemMenu(api)- .find(item => item && "uiIcon" in item && item.uiIcon === "bx bx-transfer");- if (!moveTo || !("items" in moveTo)) throw new Error("expected a move-to entry");+ const entry = openItemMenu(api).find(item =>+ item && "uiIcon" in item && item.uiIcon === "bx bx-outline");+ if (!entry || !("handler" in entry)) throw new Error("expected a duplicate entry");- const sides = moveTo.items ?? [];- expect(sides.map(item => item && "enabled" in item ? item.enabled : undefined))- .toEqual([ false, true ]);+ await entry.handler?.(entry, {} as never);- const done = sides[1];- if (done && "handler" in done) done.handler?.(done, {} as never);- expect(api.changeColumn).toHaveBeenCalledWith(expect.any(String), "Done");+ expect(api.duplicateItem).toHaveBeenCalledWith(expect.any(String), "branchId");});it("takes the card off the board, and deletes it outright", () => {@@ -322,26 +318,8 @@ describe("Board item context menu", () => {expect(deleteNotes).toHaveBeenCalledWith([ "branchId" ], false, false);});- it("copies a card into the board, after the one it was made from", async () => {- const api = {- columns: [ "To Do" ],- isColumnArchived: () => false,- getColumnIcon: () => DEFAULT_COLUMN_ICON,- getColumnColorClass: () => "",- duplicateItem: vi.fn(async () => {})- } as unknown as BoardApi;-- const entry = openItemMenu(api).find(item =>- item && "uiIcon" in item && item.uiIcon === "bx bx-outline");- if (!entry || !("handler" in entry)) throw new Error("expected a duplicate entry");-- await entry.handler?.(entry, {} as never);-- expect(api.duplicateItem).toHaveBeenCalledWith(expect.any(String), "branchId");- });-/** Opens the menu a card offers, and hands back what it was given to show. */- function openItemMenu(api: BoardApi, column = "To Do") {+ function openItemMenu(api: BoardApi, column = "To Do", focusCard = vi.fn()) {const show = vi.spyOn(contextMenu, "show").mockImplementation(async () => {});const event = {preventDefault: () => {},@@ -350,84 +328,76 @@ describe("Board item context menu", () => {pageY: 0} as ContextMenuEvent;- openNoteContextMenu(api, event, buildNote({ title: "Card" }) as FNote, "branchId", column);+ // Every item menu asks what the board calls its grouping field; a test says so only when+ // that is what it is about.+ const withDefaults = Object.assign({ getStatusLabel: () => "Status" }, api);+ openNoteContextMenu(+ withDefaults, event, buildNote({ title: "Card" }) as FNote, "branchId", column,+ focusCard);return show.mock.calls.at(-1)?.[0].items ?? [];}- /**- * The whole-way keys land on the same two entries wherever the card stands, so the menu names- * them. The one-column keys land somewhere different for every card and are left unnamed.- */- it("names the whole-way keys on the ends, and nothing on the columns beside", () => {- const api = {- columns: [ "To Do", "Doing", "Done", "Shipped" ],- isColumnArchived: () => false,- getColumnIcon: () => DEFAULT_COLUMN_ICON,- getColumnColorClass: () => ""- } as unknown as BoardApi;-- const moveTo = openItemMenu(api, "Doing").find(item =>- item && "uiIcon" in item && item.uiIcon === "bx bx-transfer");- if (!moveTo || !("items" in moveTo)) throw new Error("expected a move-to entry");+ /** Reads the run of column entries the menu puts under its Status header. */+ function statusItems(api: BoardApi, column = "To Do") {+ const items = openItemMenu(api, column);+ const header = items.findIndex(item => item && "kind" in item && item.kind === "header");+ if (header < 0) throw new Error("expected a Status header");- expect((moveTo.items ?? []).map(item => item && "shortcut" in item ? item.shortcut : null))- .toEqual([ "Ctrl+Shift+Left", undefined, undefined, "Ctrl+Shift+Right" ]);- });+ const rest = items.slice(header + 1);+ const end = rest.findIndex(item => item && "kind" in item && item.kind === "separator");+ return rest.slice(0, end < 0 ? rest.length : end);+ }- it("leaves the end a card already stands in bare", () => {+ /**+ * The columns stand in the menu itself rather than behind a submenu, so a card is filed in one+ * press. The one it is already under is shown too, ticked, so the list reads as the whole set.+ */+ it("offers every column under a Status header, ticking the one the card is under", () => {const api = {- columns: [ "To Do", "Doing", "Done" ],+ columns: [ "To Do", "Done" ],isColumnArchived: () => false,getColumnIcon: () => DEFAULT_COLUMN_ICON,- getColumnColorClass: () => ""+ getColumnColorClass: () => "",+ changeColumn: vi.fn(async () => {})} as unknown as BoardApi;- const moveTo = openItemMenu(api, "To Do").find(item =>- item && "uiIcon" in item && item.uiIcon === "bx bx-transfer");- if (!moveTo || !("items" in moveTo)) throw new Error("expected a move-to entry");+ const columns = statusItems(api);- expect((moveTo.items ?? []).map(item => item && "shortcut" in item ? item.shortcut : null))- .toEqual([ undefined, undefined, "Ctrl+Shift+Right" ]);- });+ expect(columns.map(item => item && "title" in item ? item.title : undefined))+ .toEqual([ "To Do", "Done" ]);+ // The tick goes at the trailing edge, leaving each column's own icon where it stands.+ expect(columns.map(item => item && "trailingIcon" in item ? item.trailingIcon : undefined))+ .toEqual([ "bx bx-check", undefined ]);+ // And carries the class the stylesheet weights it by.+ expect(columns.map(item => item && "className" in item ? item.className : undefined))+ .toEqual([ "board-current-column", undefined ]);- /** A hidden column is not one the keys reach, so the end is the last column drawn. */- it("counts the end over an archived column rather than onto it", () => {- const api = {- columns: [ "To Do", "Doing", "Parked" ],- isColumnArchived: (column: string) => column === "Parked",- getColumnIcon: () => DEFAULT_COLUMN_ICON,- getColumnColorClass: () => ""- } as unknown as BoardApi;-- const moveTo = openItemMenu(api, "To Do").find(item =>- item && "uiIcon" in item && item.uiIcon === "bx bx-transfer");- if (!moveTo || !("items" in moveTo)) throw new Error("expected a move-to entry");-- expect((moveTo.items ?? []).map(item => item && "shortcut" in item ? item.shortcut : null))- .toEqual([ undefined, "Ctrl+Shift+Right", undefined ]);+ const done = columns[1];+ if (done && "handler" in done) done.handler?.(done, {} as never);+ expect(api.changeColumn).toHaveBeenCalledWith(expect.any(String), "Done");});- it("marks the archived columns it offers to move a card to", () => {+ /** The card is drawn afresh under the column it lands in, so focus is asked for by name. */+ it("keeps focus on the card it files, as a move by keyboard does", () => {const api = {columns: [ "To Do", "Done" ],- isColumnArchived: (column: string) => column === "Done",+ isColumnArchived: () => false,getColumnIcon: () => DEFAULT_COLUMN_ICON,getColumnColorClass: () => "",+ changeColumn: vi.fn(async () => {})} as unknown as BoardApi;+ const focusCard = vi.fn();- const moveTo = openItemMenu(api).find(item =>- item && "uiIcon" in item && item.uiIcon === "bx bx-transfer");- if (!moveTo || !("items" in moveTo)) throw new Error("expected a move-to entry");+ const items = openItemMenu(api, "To Do", focusCard);+ const header = items.findIndex(item => item && "kind" in item && item.kind === "header");+ const done = items[header + 2];+ if (done && "handler" in done) done.handler?.(done, {} as never);- // Presence rather than wording: i18next is never initialised under test, so every title is- // undefined and asserting the text would prove nothing.- expect((moveTo.items ?? [])- .map(item => !!(item && "badges" in item && item.badges?.length)))- .toEqual([ false, true ]);+ expect(focusCard).toHaveBeenCalledWith(expect.any(String));});- it("shows each column it offers to move a card to with the icon and colour it carries", () => {+ it("shows each column with the icon and colour it carries", () => {const api = {columns: [ "To Do", "Done" ],isColumnArchived: () => false,@@ -436,14 +406,25 @@ describe("Board item context menu", () => {getColumnColorClass: (column: string) => column === "Done" ? "use-note-color" : ""} as unknown as BoardApi;- const moveTo = openItemMenu(api).find(item =>- item && "uiIcon" in item && item.uiIcon === "bx bx-transfer");- if (!moveTo || !("items" in moveTo)) throw new Error("expected a move-to entry");+ const columns = statusItems(api);- expect((moveTo.items ?? []).map(item => item && "uiIcon" in item ? item.uiIcon : undefined))+ expect(columns.map(item => item && "uiIcon" in item ? item.uiIcon : undefined)).toEqual([ DEFAULT_COLUMN_ICON, "bx bx-check-circle" ]);- expect((moveTo.items ?? [])+ expect(columns.map(item => item && "iconColorClass" in item ? item.iconColorClass : undefined)).toEqual([ "", "use-note-color" ]);});++ it("marks the archived columns among them", () => {+ const api = {+ columns: [ "To Do", "Done" ],+ isColumnArchived: (column: string) => column === "Done",+ getColumnIcon: () => DEFAULT_COLUMN_ICON,+ getColumnColorClass: () => ""+ } as unknown as BoardApi;++ expect(statusItems(api)+ .map(item => !!(item && "badges" in item && item.badges?.length)))+ .toEqual([ false, true ]);+ });});diff --git a/apps/client/src/widgets/collections/board/context_menu.ts b/apps/client/src/widgets/collections/board/context_menu.tsindex aeb9e69b39..b4d86eca62 100644--- a/apps/client/src/widgets/collections/board/context_menu.ts+++ b/apps/client/src/widgets/collections/board/context_menu.ts@@ -2,6 +2,7 @@ import { useState } from "preact/hooks";import FNote from "../../../entities/fnote";import NoteColorPicker from "../../../menus/custom-items/NoteColorPicker";+import type { CommandNames } from "../../../components/app_context";import contextMenu, { ContextMenuEvent, MenuItem } from "../../../menus/context_menu";import link_context_menu from "../../../menus/link_context_menu";import branches from "../../../services/branches";@@ -170,27 +171,40 @@ function ColumnColorPicker({ api, value, color }: { api: Api, value: string, col}/**- * The key that reaches `target` from `from`, for the two ends of the board and no others: `Ctrl`- * and `Shift` with an arrow sends a card the whole way, and the entry that answers for it is the- * same one wherever the card stands. `Ctrl` with an arrow moves a card one column and is left- * unnamed here, the entry it would land on being a different one for every card.+ * The columns a card can be filed under, standing in the menu itself rather than behind a submenu:+ * moving a card is what a board is for, and a submenu puts every column a step further away.*- * Counted over the columns the board draws. An archived column is listed in the menu but stands off- * screen unless the board is showing archived notes, and a key that walks the board steps over it.+ * Archived columns are offered like any other, since filing a card under one is a fair thing to+ * want; the badge is there so it is not a surprise when the card goes out of sight.*/-function endColumnKey(api: Api, from: string, target: string) {- const drawn = api.columns.filter((name) => !api.isColumnArchived(name));- const at = drawn.indexOf(from);- if (at < 0) {- return undefined;- }-- if (target === drawn[0] && at > 0) return "Ctrl+Shift+Left";- if (target === drawn[drawn.length - 1] && at < drawn.length - 1) return "Ctrl+Shift+Right";- return undefined;+function buildColumnItems(+ api: Api, note: FNote, column: string, onFocusCard: (noteId: string) => void+): MenuItem<CommandNames>[] {+ return api.columns.map((name) => ({+ title: name,+ uiIcon: api.getColumnIcon(name),+ iconColorClass: api.getColumnColorClass(name),+ // The one it is already under is shown rather than hidden, so the list reads as the whole+ // set of columns and says which of them this card belongs to.+ trailingIcon: name === column ? "bx bx-check" : undefined,+ className: name === column ? "board-current-column" : undefined,+ badges: api.isColumnArchived(name)+ ? [ { title: t("board_view.archived-badge") } ]+ : undefined,+ handler: () => {+ // Asked for before the write: the card is drawn afresh under the column+ // it lands in, so the element the menu was opened from will be gone.+ onFocusCard(note.noteId);+ api.changeColumn(note.noteId, name);+ }+ }));}-export function openNoteContextMenu(api: Api, event: ContextMenuEvent, note: FNote, branchId: string, column: string) {+export function openNoteContextMenu(+ api: Api, event: ContextMenuEvent, note: FNote, branchId: string, column: string,+ /** Puts focus back on the card once a change of column has drawn it under another one. */+ onFocusCard: (noteId: string) => void+) {event.preventDefault();event.stopPropagation();@@ -212,24 +226,9 @@ export function openNoteContextMenu(api: Api, event: ContextMenuEvent, note: FNoshortcut: "Enter",handler: () => api.insertRowAtPosition(column, branchId, "after")},+ { kind: "header", title: api.getStatusLabel() },+ ...buildColumnItems(api, note, column, onFocusCard),{ kind: "separator" },- {- title: t("board_view.move-to"),- uiIcon: "bx bx-transfer",- // Archived columns are offered like any other, since moving a card into one is a- // fair thing to want; the badge is there so it is not a surprise when it goes.- items: api.columns.map(columnToMoveTo => ({- title: columnToMoveTo,- uiIcon: api.getColumnIcon(columnToMoveTo),- iconColorClass: api.getColumnColorClass(columnToMoveTo),- enabled: columnToMoveTo !== column,- shortcut: endColumnKey(api, column, columnToMoveTo),- badges: api.isColumnArchived(columnToMoveTo)- ? [ { title: t("board_view.archived-badge") } ]- : undefined,- handler: () => api.changeColumn(note.noteId, columnToMoveTo)- })),- },{title: t("board_view.duplicate-item"),uiIcon: "bx bx-outline",diff --git a/apps/client/src/widgets/collections/board/index.css b/apps/client/src/widgets/collections/board/index.cssindex 466e33db06..0556f010ec 100644--- a/apps/client/src/widgets/collections/board/index.css+++ b/apps/client/src/widgets/collections/board/index.css@@ -481,3 +481,9 @@ body.mobile .board-view-container .board-add-column {max-width: 200px;word-wrap: break-word;}++/* The menu is drawn outside the board, so the column a card is already under is named rather than+ reached through `.board-view`. */+.dropdown-item.board-current-column {+ font-weight: 600;+}diff --git a/apps/client/src/widgets/collections/board/index.tsx b/apps/client/src/widgets/collections/board/index.tsxindex 8ca9f3bd25..b152a703ac 100644--- a/apps/client/src/widgets/collections/board/index.tsx+++ b/apps/client/src/widgets/collections/board/index.tsx@@ -309,7 +309,7 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveCsetColumnDropPosition(null);}, [ api, columns, shownColumns ]);- const { onKeyDown: handleKeyDown, focusColumn } = useBoardKeyboard({+ const { onKeyDown: handleKeyDown, focusColumn, focusCard } = useBoardKeyboard({containerRef,columns: shownColumns,byColumn,@@ -389,6 +389,7 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveCcolumns={shownColumns}onMoveColumn={handleColumnDrop}onFocusColumn={focusColumn}+ onFocusCard={focusCard}columnItems={byColumn.get(column)}isDraggingColumn={draggedColumn?.column === column}onColumnHover={handleColumnHover}diff --git a/apps/client/src/widgets/collections/board/keyboard.ts b/apps/client/src/widgets/collections/board/keyboard.tsindex ae9a13ad4d..29256b8184 100644--- a/apps/client/src/widgets/collections/board/keyboard.ts+++ b/apps/client/src/widgets/collections/board/keyboard.ts@@ -123,6 +123,15 @@ export function useBoardKeyboard({pendingFocus.current = { intent: { column, part: "header" } };}, []);+ /**+ * Puts focus back on a card once the board has drawn it again, for a move made from somewhere+ * other than the keyboard. A card crossing columns is drawn afresh under the new one, so the+ * element it was is gone by the time the move lands.+ */+ const focusCard = useCallback((noteId: string) => {+ pendingFocus.current = { intent: { noteId } };+ }, []);+const onKeyDown = useCallback((e: KeyboardEvent) => {const container = containerRef.current;const target = e.target as HTMLElement | null;@@ -249,7 +258,7 @@ export function useBoardKeyboard({}}, [ containerRef, columns, byColumn, api, moveColumn, insertColumn ]);- return { onKeyDown, focusColumn };+ return { onKeyDown, focusColumn, focusCard };}/** What to put focus on once a card goes: the one under it, the one over it, or the column. */