Files
wekan/docs/Features/All-Boards/Workspaces.md
T
Lauri Ojansivu 601c04504e Docs: All Boards: what each feature is, how to use it, how its numbers are calculated, how it works, and its commits.
Each of the 13 All Boards pages now opens with What it is, Read more,
How to use it and How the numbers are calculated, keeps its design text
under How it works in WeKan, and ends with the commits that built it.

Corrected where the code had moved on: the starred count in the header
counts boards, pages, swimlanes, lists and cards; Board Settings is reached
from the right sidebar; Public Boards also lists instance boards to a
signed-in visitor; permanent delete is enabled in Admin Panel / Settings /
Delete; the Archive page is named in the first header bar; every Archive
entry opens /allboards/archive; header labels hide at 1000px; the workspace
menu is a hamburger; the Shared templates scopes are an instance setting
and domains come from every email address; organizations as well as teams
must be the board admin's own to share a template with.

Thanks to xet7 !
2026-11-22 18:02:12 +02:00

13 KiB

Design: Workspaces

What it is

A workspace is a folder for boards in the left menu of All Boards. A board is filed in one workspace, and a workspace can hold other workspaces to any depth, so boards can be organised as a tree - by customer, team or project. The tree is your own: other members do not see it, and filing a board does not change the board.

Read more

How to use it

Add a workspace

  1. Open All Boards.
  2. Click + (Add Workspace) beside Workspaces in the left menu.
  3. Type the Workspace name and click Add Workspace.

Rename it, change its icon, add a sub-workspace or delete it

  1. Click the workspace's menu (the ☰ Workspace menu on its row).
  2. Change Workspace name or Workspace icon (markdown) and click Save; or type a Subworkspace name and click Add Subworkspace; or click Delete and confirm.

Deleting a workspace also deletes the workspaces under it, and their boards return to Remaining.

File a board in a workspace

  1. Drag the board's icon onto the workspace in the left menu.

Move or nest a workspace

  1. Drag the workspace by its ✥ handle (handles on) or by its icon and name (handles off).
  2. Drop it on the top quarter of another row to put it before that row, on the bottom quarter to put it after, or on the middle to make it a sub-workspace.

Fold a workspace

  1. Click the caret at the start of a workspace that has sub-workspaces, or focus it and press Enter or Space.

How the numbers are calculated

  • The count on a workspace row is the number of your boards whose profile.boardWorkspaceAssignments[boardId] is that workspace's id, counted over boards that are not archived, are of type board or template-container, have you as a member and are not internal helper boards (workspaceCount in client/components/boards/boardsList.js). Boards in sub-workspaces are not added to the parent's count.
  • Where a drop lands: with EDGE_FRACTION = 0.25, an offset in the top quarter of the row's height means before, the bottom quarter means after, and the middle half means inside (dropPosition() in models/lib/workspacesTree.js). A missing or invalid offset or height counts as inside.
  • Depth: unlimited. Each level is indented by one caret's width.
  • Workspace id for folding must match ^[A-Za-z0-9_-]{1,64}$.

How it works in WeKan

A workspace is a folder for boards, in the left menu of All Boards. It holds boards — a board is assigned to one — and it holds other workspaces, to any depth. The tree is per user: profile.boardWorkspacesTree on the user document, a plain array of { id, name, icon, iconColor, children }.

Each workspace has an address of its own — /allboards/workspaces/engineering/backend — built from the slugs of its names down the tree; see The All Boards URLs.

Which workspace a board is filed in is profile.boardWorkspaceAssignments, a map { boardId: workspaceId } on the same user document. Deleting a workspace (deleteWorkspace in server/models/users.js) removes it and its whole subtree from the tree and drops their entries from that map.

What a row shows

In reading order: the caret, the drag handle (when handles are on), the icon, the name, the ☰ menu, and the count of boards in it.

The selected workspace is filled with the theme accent, and that fill covers the icon and the name only — the menu and the count sit after it on the panel's own grey, so they are styled the same whether the row is selected or not.

Folding a workspace

A workspace that holds other workspaces has a caret at the start of its row, and it folds them away. It is the control a list has on a board and the one the left menu itself has: down while open, right while folded, with the same two words — Collapse / Uncollapse — in its tooltip.

The caret is first, before the drag handle, so the carets of a tree line up in one column whether or not the drag handles are shown. A workspace with nothing under it gets a spacer of the same width instead: a row that shifted sideways the moment it gained its first child would be a moving target.

It is an anchor with no href, so it carries role="button", tabindex="0" and a keydown handler for Enter and Space — a tree that can only be opened with a mouse is a tree half the readers cannot open. Its aria-label names the workspace as well as the action, because a label replaces the element's own text and a tree of carets would otherwise announce the same two words over and over with nothing to tell them apart.

Open is the default, and only the folded ones are stored: a missing key is an open workspace, so a tree of fifty with two folded is two keys. It is remembered in the same three layers as everything else in this menu — a Session value so the caret answers at once, profile.collapsedWorkspaces on the user document, and the wekan-collapsed-workspaces cookie when nobody is signed in.

The server method takes the workspace id into a dotted field path, and the tree it comes from is written by the client — so the id is checked against ^[A-Za-z0-9_-]{1,64}$ first. An id carrying a . or a $ would otherwise address a different field. Unfolding $unsets the key rather than storing false, so the map holds only what is folded.

Dragging one workspace onto another

Where in a row it is dropped is what the drop means:

Dropped on What it means
the top quarter of a row it becomes that row's previous sibling
the bottom quarter it becomes that row's next sibling
the middle half it becomes that row's last child — a sub-workspace

The middle is the biggest target on purpose: reordering can also be reached by aiming at the neighbouring row's far edge, but nesting has only this one.

The placeholder is a slot, not a line. While the pointer is over a row, an empty slot a row high opens above it, below it, or — for "into this one" — indented underneath it, which is exactly where the workspace will appear. A 2px dashed outline, so it reads as somewhere free rather than as content. A line between two rows is a target that has to be aimed at; a slot is a place to drop into.

The slot is a pseudo-element of the row, so the rows below it shift down and the row being aimed at stays where the pointer put it.

A workspace may not be dropped into itself or into its own descendant. The subtree would be cut off from the root and every workspace under it would go with it. It is refused by not calling preventDefault() — which is how HTML5 drag-and-drop says no — so the cursor refuses while the workspace is still in the air, rather than the drop landing and quietly doing nothing.

Coming back up is a drop like any other: a child dragged onto the edge of a root row becomes a root again. Nesting has to be undoable, or a workspace put one level too deep is stuck there.

Where a drag may start

The Show desktop drag handles toggle in the first header bar decides — the same setting swimlanes, lists, cards and the board tiles obey:

  • Handles on — the ✥ handle, and only the handle.
  • Handles off — the workspace's icon and name, which is the whole a.js-select-space. Clicking it still opens the workspace: a click and a drag are two gestures on one element.

Never the whole row: it also holds the ☰ menu and the count, and a drag from those is a drag of something else.

Two things make the handles-off drag work at all, and both are easy to leave out:

  • .nodragscroll on the anchor. The page-level dragscroll takes a mousedown it is not opted out of, and a drag that never begins is what "reordering does not work" looks like.
  • user-select: none while it is the drag source. The name is text, and a press-and-move over selectable text starts a selection — the browser owns the gesture from there and the element drag never begins.

And one thing the drop had to stop doing: a drag that starts on an anchor gets that anchor's text put into text/plain by the browser itself. The drop read text/plain first and took the workspace for a board, so it assigned nothing and the row snapped back. The drag now clearData()s before setting its own type, and the drop decides on the workspace id first.

Unlimited depth

The template draws itself for a workspace's children, so the depth of the tree is whatever has been dragged into whatever — there is no level count anywhere to raise. Each level indents by one caret's width (padding-inline-start, so a right-to-left language indents from the right by itself), which puts a child's caret under its parent's name.

File Path File Type Description
models/lib/workspacesTree.js .js module, pure What a drag does to the tree: dropPosition() and moveWorkspace() with the guards that keep a subtree attached to the root. No Meteor, no DOM.
client/components/boards/boardsList.jade .jade template workspaceTree — the row, its caret, and the recursion that gives the tree its depth.
client/components/boards/boardsList.js .js Blaze template logic The caret's helpers and handlers, the drag/drop wiring, and the drop marks.
client/components/boards/boardsList.css .css stylesheet The caret, the indentation per level, and the drop slots.
client/lib/utils.js .js client getWorkspaceCollapseState() / setWorkspaceCollapseState(): the Session value, the profile field and the signed-out cookie.
models/users.js .js model profile.boardWorkspacesTree, profile.collapsedWorkspaces, and the cookie pair for a reader who is not signed in.
server/models/users.js .js server setWorkspacesTree and setWorkspaceCollapsed.
tests/workspacesTree.test.cjs .cjs Node test The three moves and what they refuse, and that the page is wired to those rules rather than re-deriving them.

Commits