Issue 393 Header Ran Off The Screen - edmozley/freeitsm GitHub Wiki
🖥️ #393 The header ran off the right edge on laptop screens
GitHub #393, reported and fixed by @cloudcogsio · every module · fixed in 5.6.0 (#3001)
What you saw
On a laptop-sized window (1280, 1366, even 1440px with a long company name), a module with a full row of nav buttons pushed the right-hand end of the header off the page: the company switcher was cut off, and the bell, refresh and avatar - with the account menu and Sign out - could not be reached without widening the window. It started once a second company existed, because that is when the company switcher appears.
What was wrong
- Each module's nav buttons have a fixed minimum width (
assets/css/inbox.css, for examplemin-width: 115pxin Tickets), so Tickets' eight buttons could not get narrower than about 1,000px. - The nav takes the free space, but nothing let it shrink below its content, and the right-hand group did not shrink either. Whatever did not fit went past the right edge.
- The company switcher adds up to 240px more.
Was it more than one place? Every module with a full nav. With a ~25-character company name the header needed about 1,590px in Tickets, 1,530px in Assets and 1,370-1,400px in Changes, Tasks, Contracts and Domains, so six modules lost the avatar on a 1366px screen.
The fix
@cloudcogsio sent the fix on a branch; it is merged with their authorship.
assets/js/header-fit.js (loaded on every page with the waffle menu) measures the header as it is drawn, and again whenever its width changes, and steps the nav down only as far as the width needs:
header-fit-tight: the buttons drop their minimum width and use less padding.header-fit-icons: icon-only buttons, each keeping its name as a tooltip.
The waffle and the right-hand group never shrink, so the avatar always stays on the page. Widening the window brings the labels back. Phones (768px and below) keep the menu drawer and are not affected.
📁 Files
| File | Change |
|---|---|
🟡 assets/js/header-fit.js |
New: measure and step down |
🔵 assets/css/inbox.css |
The two steps, desktop only |
🟣 includes/waffle-menu.php |
Loads the script |
| ⚪ ~230 pages | inbox.css cache-busters |
How it was verified
Reproduced first on a test install with a second company called "ZZ Northern Regional Health Trust": in Tickets and Assets the right-hand group ended at 1590px and 1546px, in windows of 1280px and 1366px. After the fix, all four ended inside the window (1260px at 1280, 1346px at 1366), using only the first step. @cloudcogsio's branch was tested on all 28 module headers at 1680, 1440, 1366, 1280, 1024 and 800px.
What this means for you
Update to 5.6.0 and the whole header, including your avatar and Sign out, stays on screen at laptop widths.
Follow-up, 5.8.0: the third step - icons that scroll sideways when even they do not fit - could leave the first button out of reach in a centred nav, and nothing showed there were more. Fixed in #411, which also writes up what this review missed: it was verified only at widths where step 1 fires.
Related: Multi-tenancy · #411 Header buttons out of reach