Skip to content

Issue 425 Label Beside Left A Wide Gap

Ed Mozley edited this page Nov 22, 2026 · 1 revision

πŸ“ #425 A label beside its answer left a wide gap

GitHub #425, reported by @pappas81 Β· Forms Β· fixed in 5.9.1 (#3116)

What you saw

A form question can have its label above the answer (the default) or beside it. With two half-width questions side by side and their labels beside, a short label like User sat at the far left with a wide empty gap before its box - the label had far more room than it needed, and the answer box less.

What was wrong

"Beside" turns the question into a two-column grid: the label in the first column, the answer in the second. The columns were fixed at one third and two thirds of the question's width, however long the label was:

/* assets/css/form-shared.css (before) */
.form-field[data-label-pos="beside"] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    ...
}

On a half-width question about 600px wide, that is 200px for the label. User needs about 40.

It was three places, not one

The same grid is written three times, because the label lands on different markup in each place a form is drawn:

Where Selector
Filling a form in (staff) .form-field[data-label-pos="beside"]
The self-service portal .cat-field[data-label-pos="beside"]
The form editor's preview .preview-slot[data-label-pos="beside"] > .preview-field

All three had the fixed thirds, so all three changed.

The fix

The label column is now as wide as its text, up to 40% of the question:

/* assets/css/form-shared.css (after) */
grid-template-columns: fit-content(40%) minmax(0, 1fr);

fit-content(40%) means: as wide as the label wants, but never more than 40% - a long label wraps onto more lines instead of squeezing the answer. The answer takes everything else.

The trade-off

With fixed thirds, the answer boxes of questions in different rows lined up in one column, because every label column was the same width. Now each label takes what it needs, so a short label's box starts further left than a long label's box in the row below. For forms with very different label lengths stacked on top of each other, above still gives the tidiest column.

On a phone nothing changes: beside already becomes above below 768px.

πŸ“ Files

File Change
πŸ”΅ assets/css/form-shared.css Label column fits its text, up to 40% - all three surfaces
🟣 forms/fill.php, forms/collection.php, forms/submissions.php, forms/edit/index.php, self-service/includes/header.php form-shared.css?v=7

How it was verified

A page with two half-width rows was drawn in a desktop browser with the new stylesheet: User and Provider sit right next to their boxes, Cost centre likewise, and a deliberately long label wraps to three lines within its 40% while its box keeps the rest. The page did not scroll sideways.

What this means for you

Upgrade to 5.9.1 and hard-refresh (Ctrl-F5). Forms using beside tighten up by themselves; nothing needs changing in the editor.

Related

FreeITSM

Getting Started

Modules

Multi-tenancy (planned)

Responses to feedback

Blue sky thinking

Bugs resolved

Pull requests

Links

Clone this wiki locally