# Design: the header ## What it is WeKan has **one** header bar. It is always on screen, it says where you are, and it holds the controls of whatever page you are on. There used to be two. The first was a thin strip with the house icon, the logo and your account; the second was a coloured block that every page filled with its own title and its own buttons. That second bar is gone from every page but the few that still have something only it can hold, and `#header` is not rendered at all where a page has none — it is a coloured block with a height of its own, so leaving it in painted a tall empty strip under the first bar. ## Read more - [Navigation bar](https://en.wikipedia.org/wiki/Navigation_bar), [Breadcrumb navigation](https://en.wikipedia.org/wiki/Breadcrumb_navigation) and [Hamburger button](https://en.wikipedia.org/wiki/Hamburger_button) on Wikipedia - the page title's path and the sidebar toggle. - [Fullscreen API](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API) on MDN - what the full screen button uses. - [flex-wrap](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap), [display](https://developer.mozilla.org/en-US/docs/Web/CSS/display) (for `display: contents`), [CSS logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values) and [ResizeObserver](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) - how the bar wraps, mirrors and measures itself. - [WCAG 2.1: Label in Name](https://www.w3.org/WAI/WCAG21/Understanding/label-in-name.html) - why every button shows its name. - In WeKan: [Starred](../Pages/Starred.md), [Board key](Board-Title/Board-Key.md), [Admin Panel URLs](../Admin-Panel/Admin-Panel-URLs.md), [All Boards URLs](../All-Boards/URLs.md). ## How to use it 1. Click the **house** at the start of the bar to go to All Boards. 2. Click the **collapse control** right after the house to hide the icons from the phone/desktop toggle through the notification bell; click it again to show them. 3. Read the page title after it; hover it to see the whole path, e.g. *All Boards / Workspaces / Engineering / Backend*. 4. On a board, as a board admin, click the board's **title** to rename it (and to change its [board key](Board-Title/Board-Key.md)). 5. Click the full screen button to the right of the logo (**Maximize**); click it again (**Minimize**) or press Esc to leave full screen. 6. On a board, click the **caret** before the board's controls to fold Private, Muted, Sort Cards, Filter, Search, Show dependencies and Multi-Selection away, and again to bring them back. 7. Use the **star group**: the caret and count open your starred items, the star stars or unstars what you are looking at. See [Starred](../Pages/Starred.md). 8. Click **Filter** or **Search** to open the sidebar on that view, and again to close it (Filter stays open while a filter is on). 9. At the end of the bar: help, your **avatar and name** (the member menu), and the **hamburger** that opens the page's sidebar where the page has one. ## How the numbers are calculated ### Where the bar starts The All Boards **house** is the first thing on the page, and it starts on the same vertical line as the **left menu's rows** below it — **22px** — at *every* window width. One line down the left edge of the page. That 22px is a **sum**, and the whole of it is: - **12px** — `--wekan-header-gutter`, the bar's own padding. It is on the BAR rather than on its first item because the bar wraps: padding applies to every row it wraps onto, while a margin on the first item would indent the first row and leave the second starting at the edge. - **4px** — `.home-icon`'s inline-start margin, the same 4px every item in the bar carries. - **6px** — the `.header-home-link`'s own padding, which is its hover target, not an inset. The left menu reaches the same 22px its own way: 4px of row margin plus 18px of row padding (`boardsList.css`, `settingBody.css`), and both menus indent alike. **Nothing else may add to that sum at some widths only.** Two things did, which is why the house sat at a different X on a phone, a tablet, a desktop and a large display: - `#header` had side padding of its own — 8px ≤800px, 16px at 768–1024px, none between, 8px at ≥1920px. It has **none** now, at any width: the inset is the bar's gutter, once. - `.allBoards` is the **same element** as `.home-icon` (`span.home-icon.allBoards`), so its side padding lands between the icon's margin and the link — and it was 15px on a desktop against 6px on a phone. It carries `padding-block` only now. Its 15px was also the gap to the logo beside it; that gap is the 4 + 4 of the two margins, like every other pair of neighbours in this bar. The rules for the link itself all start it at the same 6px, phone rules included: a bigger tap target on a small screen grows at the **end**, not at the start. `tests/headerBars.test.cjs` pins both halves — the sum, and that no rule at any width adds to it. ### Spacing, sizes and the height below the bar - Every item has **4px** on each side, so two neighbours are **8px** apart. - The bell, a fixed **28px** square elsewhere, sizes to its content in this bar so its label fits. - On narrow screens the username is `font-size: 0` except on All Boards and the Admin Panel, because a full name is easily 100px of a 375px bar. - `--wekan-header-height` is the bottom of the lowest header bar present (not a sum of heights), kept current by one `ResizeObserver` per bar in `client/lib/utils.js`. - The fold state lasts the session (`client/lib/foldState.js`). ## How it works in WeKan ### What the bar says The header starts with the **Home icon**, the **collapse control**, then **the page you are on**. The collapse control sits immediately to the right of Home in left-to-right languages, before the page or board title. It hides the icons from the mobile/desktop toggle through the notification bell; Home, the collapse control and the title remain visible. The order follows the writing direction in right-to-left languages. The title used to read "All Boards" on every page, so the one bar that is always on screen named a place you were not. `models/lib/pageTitles.js` maps a route name to a translation key. Three sources, in order: 1. **the board's title**, wherever there is a board — the one thing worth having there; 2. **a custom title** — Support and Accessibility can be renamed by an admin, and Import names its source ("Import / Trello"); 3. **the key** for everything else. A board title and a custom title both come back as `title` rather than `key`, because both are text to print as-is: neither may go through the translator, and a board called "settings" is not the Admin Panel. A route nobody has added answers with nothing and the bar shows nothing — better than naming the wrong page. #### …and the path, in its tooltip Two pages are several places under one name. The bar shows the **root** — `All Boards`, `Admin Panel` — and the whole path is the title's **tooltip**: ``` All Boards / Workspaces / Engineering / Backend Admin Panel / Settings / Version ``` The path is what the page *is*, but it grows — a workspace nests as deep as its tree does — and this bar is the one strip always on screen and already short of width. So the root names the place and the tooltip carries the rest. `headerTitleFullPath()` in `client/components/main/header.js` resolves it to one string, because a `title` attribute is plain text and cannot hold the `{{_ }}` calls the visible version used. It reads the **same** `headerTitle()` and the same trail the visible name does, so the two cannot disagree about where you are. A workspace's own name still does not go through the translator. The trail itself is `headerTitleTrailOf()`, a **plain function rather than a helper**: the tooltip needs it too, and a Blaze helper cannot call a sibling helper — `this` there is the data context, not the helpers object. It is **one list** rather than a helper per segment, because the two pages do not have the same number of them: the Admin Panel always has two, and a workspace has as many as its tree is deep. Each entry is one of the two forms a left-menu entry has — `key` for something translated, `title` for text that must not be. The words are the ones the navigation beside it already uses — the Admin Panel's tab key and its menu row's label ([Admin Panel URLs](../Admin-Panel/Admin-Panel-URLs.md)), the All Boards left-menu key and the workspace's own name ([All Boards URLs](../All-Boards/URLs.md)) — so the tooltip and the thing highlighted next to it cannot say different things about one place. It is read from the **URL** and from the user document, never from the pages themselves. The header is a separate Blaze instance, and importing a page module from it once ran that module before its own template was registered; the throw aborted every module after it, which is why `client/lib/pageTitleSources.js` exists — it registers no template and touches no DOM, so it is safe to load early. ### What the bar holds In source order: the house and the page title, the logo, the full screen button, the phone/desktop toggle, the drag-handles toggle, and then everything else. **Full screen.** A button to the right of the logo puts the whole page in full screen and takes it out again, with the Fullscreen API (`models/lib/fullscreen.js`): the icon is an expand arrow, and a compress arrow while the page is in full screen, and it follows the browser's own way out (Esc) too. Its label is the existing "Maximize", and "Minimize" while the page is in full screen, so the same button says how to leave (Esc and the browser's own control work too). It is drawn only where the browser offers the API and the page may use it - iPad Safari, desktop browsers and Android browsers do; **iPhone Safari does not** (the API is for video there) and neither does a page inside an `