[Firefox] Main website download button label is cut-off
Description
Just visited the Opencode website to give it a try, noticed the download button label is cut-off. I still downloaded it.
Happens only on Firefox, with or without uBlock origin installed.
Plugins
OpenCode version
Steps to reproduce
- Go to https://opencode.ai/
- Notice the Download button label is cut-off to the right
Screenshot
Operating System
Windows 11
Terminal
Thanks for the report! I reproduced this: on https://opencode.ai/ in Firefox, the header Download button comes out about 21px narrower than in Chromium, which cuts off the last letter of the label. Chromium shows the full label. The screenshots below show both browsers. I tested headless Firefox on Linux rather than Windows, but it happened at every window width I tried. The script below measures the button in both browsers.
The likely cause is that Firefox doesn't count the button's 18px download icon when it works out the minimum width, so the header shrinks the button by about the width of that icon. The code for this is the same on the latest dev (0b1b6308), so it hasn't been fixed yet.
Related: #62024 (closed) was a different header Download button layout bug, on /go and /zen in Chrome.
Reproduction script (check.mjs)
// Checks the "Download" buttons on https://opencode.ai/ in Firefox and Chromium for clipped labels.
// Usage: npm i playwright && npx playwright install --with-deps firefox chromium && node check.mjs
import { firefox, chromium } from "playwright"
const url = process.env.URL ?? "https://opencode.ai/"
for (const [name, type] of [["firefox", firefox], ["chromium", chromium]]) {
for (const width of [1350, 1920]) {
const browser = await type.launch()
const page = await browser.newPage({ viewport: { width, height: 800 }, deviceScaleFactor: 2 })
await page.goto(url, { waitUntil: "networkidle" })
await page.waitForTimeout(1500)
const info = await page.evaluate(() =>
[...document.querySelectorAll("a,button")]
.filter((e) => /download/i.test(e.textContent ?? "") && e.getBoundingClientRect().width > 0)
.map((e) => {
const r = e.getBoundingClientRect()
const kids = [...e.querySelectorAll("*")].map((k) => k.getBoundingClientRect())
const maxRight = Math.max(r.right, ...kids.map((k) => k.right))
return {
text: e.textContent.trim().slice(0, 40),
cls: e.className?.toString?.().slice(0, 60),
box: [Math.round(r.left), Math.round(r.top), Math.round(r.width), Math.round(r.height)],
scrollW: e.scrollWidth,
clientW: e.clientWidth,
contentOverflowPx: Math.round(maxRight - r.right),
overflow: getComputedStyle(e).overflow,
}
}),
)
console.log(name, width, JSON.stringify(info, null, 1))
await page.screenshot({ path: `/workspace/repro/${name}-${width}.png` })
await browser.close()
}
}
Run it: bun check.mjs
I'd like to take this one. Following the triage, Firefox leaves the 18px icon out of the button's minimum width, so the header shrinks it. My plan is to stop the button from shrinking below its content (flex-shrink: 0 / min-width: max-content on that button), then check it in Firefox and Chromium at several widths, and on /go and /zen so #62024 doesn't come back.
Update: this no longer reproduces. The header with this Download button was part of the old site, which #62388 removed, and the current opencode.ai pages (/, /console/go, /console/models) no longer render it. services/site/src/component/header.tsx is still in the tree but nothing imports it.
I think this can be closed. If useful, I can open a small PR that removes the unused header.tsx and its header-context-menu.css.
This was fixed by #62388, which replaced the old opencode.ai site and removed the header with that Download button. The current pages no longer render it, and a contributor confirmed the cut-off label no longer shows in Firefox. If you still see a clipped button anywhere on the site, comment here and we'll reopen.