ARTICLE
Notes

A button that cannot say what it does

7 November 2026Majed Alandajani

I had a real problem: a long English label pushed the page 72 pixels sideways. Horizontal overflow is an ugly defect, so I capped the button width and clipped whatever stuck out.

The overflow disappeared. Something worse took its place.

What actually shipped

An actions list with five buttons reading: "سُد", "تحُ", "حذ".

I measured them afterwards. One button needed 118 pixels and got 28. Another needed 165 and got 98.

Why the trade was wrong

Horizontal overflow is visible. You see it, you know something broke, you fix it.

A clipped label is silent. The page looks tidy and the button still looks like a button, while half of its label has quietly vanished.

I had swapped a defect that announces itself for one that hides. That trade loses every time.

The technical cause

Clipping alone could not have done this much damage. The containers were also splitting the width equally, so each button took a fifth of the space and then clipped whatever did not fit.

The fix

A button never shrinks below its own text, and it is never clipped. A label that runs out of room wraps inside the button and stays readable, or the whole button drops to a new line.

The cap stayed. The clipping went.

The check that did not exist

Every visual check I had was passing. The page did not scroll sideways and the console was clean. The translation strings were correct too.

All of them measured the page. None of them asked whether a button could still say what it does.

I added the check:


el.scrollWidth > el.clientWidth   // the text is bigger than its box

Then I restored the old code to prove it works: the check failed on exactly those buttons.

The practical conclusion

Do not fix a visible problem by hiding it. A check that only measures the page will miss this class of bug, because the page can be perfectly correct while the words inside it cannot be read.

Related reading

Have a project in mind?
Tell me what you want to build. Your first 15 minutes of consulting are free.
Book a consultation