Canvix — Free & open-source graphic design tool. A community-built Canva alternative with a drag-and-drop editor, templates, shapes, text, images & one-click export. Works on desktop, tablet & mobile.
TypeScript canva-alternativecanvasdesigndesign-tooldrag-and-dropeditorgraphic-designkonvanextjsopen-sourcereactself-hostedtemplatestypescript
fix(v0.11.3): Elements panel tab strip — single scrollable row + AA contrast
Ashiq Hussain Mir3d47cfe2f306
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d8659fc..e015e43 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -3,6 +3,49 @@All notable changes to Canvix will be documented in this file.The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).+## [0.11.3] — 2026-10-30++One mobile UI bug with two loud symptoms and a quiet third one hiding in+plain sight on desktop.++### Fixed+- **Elements panel category tabs broke out of their bar on narrow+ screens** — the strip was `grid grid-cols-4` with a fixed `h-8`, but+ there are 7 categories: Shapes/Lines/Graphics/Stickers filled row one+ and Tables/Frames/Embeds wrapped into a second row that painted+ outside the 32px-tall bar. On a phone the Tables tab floated detached+ over the panel divider and content (the reported screenshot); the same+ overflow existed on desktop — the side panel is 320px there too — it+ was just less obvious against the content. The strip is now a+ single-row, horizontally scrollable bar (`overflow-x-auto`, hidden+ scrollbar, no horizontal scroll chaining). Every category stays+ reachable by swipe/scroll and keyboard (Radix roving focus scrolls+ the trigger into view) — nothing is hidden or dropped.+- **Inactive tab labels were nearly invisible in dark panels (≈1.3:1)** —+ the app never applies Tailwind's `.dark` class (the editor's dark+ chrome is hand-painted), so the shadcn Tabs default `text-foreground`+ resolved to the light-theme near-black `oklch(0.145 0 0)` ≈ `#0a0a0a`+ on the dark bar. Tabs now set an explicit `text-white/65` — 7.4:1 on+ the white@5% bar (WCAG AA; the active white-on-purple pill is 6.6:1).+- **Inconsistent tab metrics** — the last three tabs shipped at+ `text-[11px]` beside `text-xs` siblings (and measured 25px vs 26px+ tall). All seven tabs now render from one shared class: identical+ height, padding, font size, radius, hover and active states.+- **Photos & Templates filter chips wrapped unpredictably at narrow+ widths** — same treatment: single-row swipeable chip strips that+ scroll full-bleed under the panel padding; chips no longer wrap or+ shrink. Their label colors already passed AA (7.0:1 / 8.0:1) and are+ unchanged.++### Added+- `.cv-tabscroll` utility (globals.css) for the single-row scroll+ strips: `scrollbar-width: none` + `overscroll-behavior-x: contain`.+- Playwright regression suite `panels-responsive.spec.ts` (7 tests):+ at 320 / 360 / 390 / 430px and desktop — one row, shared metrics,+ strip scrollable, no overlap with the divider/description/content,+ the last tab reachable and functional, and a computed-style WCAG+ contrast lock (≥ 4.5:1) on the inactive label.+## [0.11.2] — 2026-10-30Two production bugs: an editor crash with an easy-to-miss root cause,diff --git a/package-lock.json b/package-lock.jsonindex 616b479..b2d6ae8 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,12 +1,12 @@{"name": "canvix",- "version": "0.9.3",+ "version": "0.11.3","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "canvix",- "version": "0.9.3",+ "version": "0.11.3","hasInstallScript": true,"dependencies": {"@imgly/background-removal": "^1.7.0",diff --git a/package.json b/package.jsonindex fc424e5..9bcce9d 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "canvix",- "version": "0.11.2",+ "version": "0.11.3","private": false,"description": "Canvix — free & open-source graphic design tool. A community-built Canva alternative.","scripts": {diff --git a/src/app/globals.css b/src/app/globals.cssindex 22c3513..bb26426 100644--- a/src/app/globals.css+++ b/src/app/globals.css@@ -457,6 +457,17 @@border-radius: 999px;}+/* v0.11.3: single-row swipeable strips (Elements category tabs, Photos/Templates+ filter chips) — scroll instead of wrap. No visible scrollbar (a cut-off label+ is the affordance), and no horizontal scroll chaining to the page. */+.cv-tabscroll {+ scrollbar-width: none;+ overscroll-behavior-x: contain;+}+.cv-tabscroll::-webkit-scrollbar {+ display: none;+}+/* landing animations */@keyframes cv-fade-up {from {diff --git a/src/components/editor/panels/ElementsPanel.tsx b/src/components/editor/panels/ElementsPanel.tsxindex 8be941f..a12313e 100644--- a/src/components/editor/panels/ElementsPanel.tsx+++ b/src/components/editor/panels/ElementsPanel.tsx@@ -45,6 +45,22 @@ const TABLE_STYLES: { id: TableStyle; label: string; swatch: React.CSSProperties{ id: 'soft', label: 'Soft', swatch: { background: '#F2FBFC', border: '1px solid #02C0CC' } },]+/** v0.11.3: category strip config — one source of truth so every tab shares metrics. */+const CATEGORY_TABS = [+ { value: 'shapes', label: 'Shapes' },+ { value: 'lines', label: 'Lines' },+ { value: 'graphics', label: 'Graphics' },+ { value: 'stickers', label: 'Stickers' },+ { value: 'tables', label: 'Tables' },+ { value: 'frames', label: 'Frames' },+ { value: 'embeds', label: 'Embeds' },+] as const++/** One shared class ⇒ identical height, padding, type size and states on every tab.+ * text-white/65 on the white@5% bar = 7.38:1 (WCAG AA, was ~1.3:1 via text-foreground). */+const CATEGORY_TAB_CLS =+ 'h-7 flex-none whitespace-nowrap rounded-md px-3 text-xs text-white/65 hover:text-white/90 transition-colors data-[state=active]:bg-[#7630D7] data-[state=active]:text-white'+export function ElementsPanel() {const [tab, setTab] = useState('shapes')const [query, setQuery] = useState('')@@ -74,14 +90,18 @@ export function ElementsPanel() {aria-label={searchPlaceholder}/></div>- <TabsList className="mt-3 w-full grid grid-cols-4 h-8 bg-white/[0.05]">- <TabsTrigger value="shapes" className="text-xs data-[state=active]:bg-[#7630D7] data-[state=active]:text-white">Shapes</TabsTrigger>- <TabsTrigger value="lines" className="text-xs data-[state=active]:bg-[#7630D7] data-[state=active]:text-white">Lines</TabsTrigger>- <TabsTrigger value="graphics" className="text-xs data-[state=active]:bg-[#7630D7] data-[state=active]:text-white">Graphics</TabsTrigger>- <TabsTrigger value="stickers" className="text-xs data-[state=active]:bg-[#7630D7] data-[state=active]:text-white">Stickers</TabsTrigger>- <TabsTrigger value="tables" className="text-[11px] data-[state=active]:bg-[#7630D7] data-[state=active]:text-white">Tables</TabsTrigger>- <TabsTrigger value="frames" className="text-[11px] data-[state=active]:bg-[#7630D7] data-[state=active]:text-white">Frames</TabsTrigger>- <TabsTrigger value="embeds" className="text-[11px] data-[state=active]:bg-[#7630D7] data-[state=active]:text-white">Embeds</TabsTrigger>+ {/* v0.11.3: single-row swipeable strip. The old grid-cols-4 wrapped 7 tabs+ into a second row that painted outside the fixed h-8 bar, over the+ panel divider and content ("Tables" floating mid-panel on mobile). */}+ <TabsList+ aria-label="Element categories"+ className="cv-tabscroll mt-3 flex h-9 w-full items-center justify-start gap-1 overflow-x-auto rounded-lg bg-white/[0.05] p-1"+ >+ {CATEGORY_TABS.map((t) => (+ <TabsTrigger key={t.value} value={t.value} className={CATEGORY_TAB_CLS}>+ {t.label}+ </TabsTrigger>+ ))}</TabsList></div>diff --git a/src/components/editor/panels/PhotosPanel.tsx b/src/components/editor/panels/PhotosPanel.tsxindex 5bbc3b4..f8e1827 100644--- a/src/components/editor/panels/PhotosPanel.tsx+++ b/src/components/editor/panels/PhotosPanel.tsx@@ -126,13 +126,13 @@ export function PhotosPanel() {searchPlaceholder="Search photos (e.g. mountain, coffee, beach)"onSearch={setQuery}belowSearch={- <div className="flex gap-1.5 flex-wrap mt-2.5">+ <div className="cv-tabscroll -mx-4 mt-2.5 flex gap-1.5 overflow-x-auto px-4">{CATEGORIES.map((c) => (<buttonkey={c.id}onClick={() => setCat(c.id)}className={cn(- 'h-7 px-3 rounded-full text-[11.5px] font-semibold transition-colors border',+ 'h-7 shrink-0 whitespace-nowrap rounded-full px-3 text-[11.5px] font-semibold transition-colors border',cat === c.id? 'bg-white/[0.16] text-white border-white/25': 'bg-transparent text-white/65 border-white/10 hover:bg-white/[0.07] hover:text-white'diff --git a/src/components/editor/panels/TemplatesPanel.tsx b/src/components/editor/panels/TemplatesPanel.tsxindex ca89e0b..5be3ed3 100644--- a/src/components/editor/panels/TemplatesPanel.tsx+++ b/src/components/editor/panels/TemplatesPanel.tsx@@ -69,13 +69,14 @@ export function TemplatesPanel() {</button>)}</div>- <div className="mt-3 flex gap-1.5 flex-wrap">+ {/* v0.11.3: single-row swipeable chips — full-bleed scroll under the panel padding */}+ <div className="cv-tabscroll -mx-4 mt-3 flex gap-1.5 overflow-x-auto px-4">{[{ id: 'all', label: 'All' }, ...TEMPLATE_CATEGORIES.map((c) => ({ id: c.id, label: c.label }))].map((c) => (<buttonkey={c.id}onClick={() => setCategory(c.id)}className={cn(- 'rounded-full px-3 py-1 text-xs font-medium border transition-colors',+ 'shrink-0 whitespace-nowrap rounded-full px-3 py-1 text-xs font-medium border transition-colors',category === c.id ? 'bg-[#7630D7] text-white border-transparent' : 'border-white/12 text-white/60 hover:border-white/30 hover:text-white')}>diff --git a/tests/e2e/panels-responsive.spec.ts b/tests/e2e/panels-responsive.spec.tsnew file mode 100644index 0000000..91f1902--- /dev/null+++ b/tests/e2e/panels-responsive.spec.ts@@ -0,0 +1,180 @@+import { test, expect, type Page } from '@playwright/test'++/**+ * v0.11.3 regression — responsive panel navigation.+ *+ * The Elements panel category strip was `grid grid-cols-4` with a fixed+ * `h-8`: 7 tabs wrapped into a second row that painted OUTSIDE the 32px+ * bar, over the panel divider and the content below (on a phone the+ * "Tables" tab floated detached mid-panel). Inactive labels also fell+ * back to the light-theme `text-foreground` (≈ #0a0a0a) because the app+ * never applies the `.dark` class — ≈ 1.3:1 on the dark bar, i.e. nearly+ * invisible.+ *+ * The strip (and the Photos / Templates filter chips, which wrapped+ * unpredictably) are now single-row, horizontally scrollable bars with+ * shared tab metrics and explicit white/65 inactive text (7.4:1).+ * These tests lock that in at the widths the bug was reported on.+ */++const MOBILE_WIDTHS = [320, 360, 390, 430] as const+const CATEGORIES = ['Shapes', 'Lines', 'Graphics', 'Stickers', 'Tables', 'Frames', 'Embeds'] as const++async function openEditorPanel(page: Page, panel: string) {+ await page.goto('/')+ // Next.js dev tools indicator (bottom-left "N" badge) overlays the first+ // rail button in dev mode — hide the portal so rail clicks stay reachable.+ // (Production builds don't mount it at all.)+ await page.addStyleTag({ content: 'nextjs-portal { display: none !important; }' })+ await page.getByRole('button', { name: /start designing/i }).first().click()+ await page+ .locator('section:has(h2:text("Start a new design")) [aria-label^="Create "]')+ .first()+ .click()+ await expect(page.getByLabel('Design canvas')).toBeVisible({ timeout: 30_000 })+ await page.getByRole('button', { name: panel }).click()+}++for (const width of MOBILE_WIDTHS) {+ test(`Elements strip: single scrollable row at ${width}px`, async ({ page }) => {+ await page.setViewportSize({ width, height: 800 })+ await openEditorPanel(page, 'Elements')++ const strip = page.getByRole('tablist', { name: 'Element categories' })+ await expect(strip).toBeVisible()+ const tabs = page.getByRole('tab')+ await expect(tabs).toHaveCount(CATEGORIES.length)++ // 1 ▸ every tab on ONE row, identical height + font size (was: 4+3 wrap,+ // 12px/11px mixed, second row outside the bar)+ const boxes = await tabs.evaluateAll((els) =>+ els.map((el) => {+ const r = el.getBoundingClientRect()+ return { y: r.y, h: r.height, bottom: r.bottom, fontSize: getComputedStyle(el).fontSize }+ }),+ )+ expect([...new Set(boxes.map((b) => Math.round(b.y)))]).toHaveLength(1)+ expect([...new Set(boxes.map((b) => Math.round(b.h)))]).toHaveLength(1)+ expect([...new Set(boxes.map((b) => b.fontSize))]).toHaveLength(1)++ // 2 ▸ the strip scrolls instead of clipping — all 7 tabs live in one+ // overflow row (nothing is hidden or dropped)+ const geom = await strip.evaluate((el) => ({ sw: el.scrollWidth, cw: el.clientWidth }))+ expect(geom.sw).toBeGreaterThanOrEqual(geom.cw)++ // 3 ▸ no tab may paint outside the strip (the old second row did,+ // overlapping the divider, description and content)+ const stripBox = (await strip.boundingBox())!+ for (const b of boxes) {+ expect(b.bottom).toBeLessThanOrEqual(stripBox.y + stripBox.height + 0.5)+ }++ // 4 ▸ every category is reachable — activate the LAST tab from the strip+ await page.getByRole('tab', { name: 'Embeds' }).click()+ await expect(page.getByText('Add a link card')).toBeVisible()++ // 5 ▸ a mid-strip category swaps content without overlapping the strip+ await page.getByRole('tab', { name: 'Tables' }).click()+ const desc = await page.getByText('Tables are native elements').boundingBox()+ expect(desc!.y).toBeGreaterThanOrEqual(stripBox.y + stripBox.height - 1)++ // 6 ▸ contrast lock — inactive label ≥ 4.5:1 against bar-over-panel+ // (was ≈ 1.3:1 via light-theme text-foreground on the dark bar)+ const contrast = await page.evaluate(() => {+ const parse = (src: string): { rgb: [number, number, number]; a: number } => {+ const s = src.trim()+ let m = /^rgba?\(([^)]+)\)$/.exec(s)+ if (m) {+ const p = m[1].split(',').map((v) => parseFloat(v))+ return { rgb: [p[0], p[1], p[2]], a: p.length > 3 ? p[3] : 1 }+ }+ m = /^oklab\(([\d.e+-]+) ([\d.e+-]+) ([\d.e+-]+)(?:\s*\/\s*([\d.]+))?\)$/.exec(s)+ if (m) {+ const [L, a, b] = [parseFloat(m[1]), parseFloat(m[2]), parseFloat(m[3])]+ const alpha = m[4] !== undefined ? parseFloat(m[4]) : 1+ const l_ = L + 0.3963377774 * a + 0.2158037573 * b+ const m_ = L - 0.1055613458 * a - 0.0638541728 * b+ const s_ = L - 0.0894841775 * a - 1.291485548 * b+ const [l, mm, ss] = [l_ ** 3, m_ ** 3, s_ ** 3]+ const lin = [+ 4.0767416621 * l - 3.3077115913 * mm + 0.2309699292 * ss,+ -1.2684380046 * l + 2.6097574011 * mm - 0.3413193965 * ss,+ -0.0041960863 * l - 0.7034186147 * mm + 1.707614701 * ss,+ ]+ const enc = (c: number) =>+ Math.round(255 * (c <= 0.0031308 ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - 0.055))+ return { rgb: [enc(lin[0]), enc(lin[1]), enc(lin[2])], a: alpha }+ }+ throw new Error(`parseColor: unsupported computed color "${src}"`)+ }+ const strip = document.querySelector('[role=tablist]')!+ const tab = [...strip.querySelectorAll('[role=tab]')].find(+ (t) => t.getAttribute('aria-selected') !== 'true',+ )!+ const fg = parse(getComputedStyle(tab).color)+ const bar = parse(getComputedStyle(strip).backgroundColor)+ const panel = parse(getComputedStyle(strip.closest('aside')!).backgroundColor)+ const over = (+ f: { rgb: [number, number, number]; a: number },+ b: [number, number, number],+ ): [number, number, number] =>+ [0, 1, 2].map((i) => f.rgb[i] * f.a + b[i] * (1 - f.a)) as [number, number, number]+ const barPx = over(bar, panel.rgb)+ const textPx = over(fg, barPx)+ const lum = ([r, g, b]: [number, number, number]) => {+ const f = (c: number) => {+ const v = c / 255+ return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4)+ }+ return 0.2126 * f(r) + 0.7152 * f(g) + 0.0722 * f(b)+ }+ const l1 = lum(textPx)+ const l2 = lum(barPx)+ const [hi, lo] = l1 > l2 ? [l1, l2] : [l2, l1]+ return (hi + 0.05) / (lo + 0.05)+ })+ expect(contrast).toBeGreaterThanOrEqual(4.5)+ })+}++test('Elements strip stays a single row on desktop (320px sidebar)', async ({ page }) => {+ await openEditorPanel(page, 'Elements')+ const tabs = page.getByRole('tab')+ await expect(tabs).toHaveCount(CATEGORIES.length)+ const ys = await tabs.evaluateAll((els) => [+ ...new Set(els.map((el) => Math.round(el.getBoundingClientRect().y))),+ ])+ expect(ys).toHaveLength(1)+ // desktop panel is 320px wide — the 7 tabs still overflow into a scroll row+ const strip = page.getByRole('tablist', { name: 'Element categories' })+ const geom = await strip.evaluate((el) => ({ sw: el.scrollWidth, cw: el.clientWidth }))+ expect(geom.sw).toBeGreaterThan(geom.cw)+ await page.getByRole('tab', { name: 'Embeds' }).click()+ await expect(page.getByText('Add a link card')).toBeVisible()+})++test('Photos filter chips scroll in one row instead of wrapping', async ({ page }) => {+ await page.setViewportSize({ width: 320, height: 800 })+ await openEditorPanel(page, 'Photos')+ const chips = page.locator('aside .cv-tabscroll').first()+ await expect(chips).toBeVisible()+ const row = await chips.evaluate((el) => {+ const kids = [...el.children].map((k) => Math.round(k.getBoundingClientRect().y))+ return { ys: [...new Set(kids)], sw: el.scrollWidth, cw: el.clientWidth }+ })+ expect(row.ys).toHaveLength(1)+ expect(row.sw).toBeGreaterThanOrEqual(row.cw)+})++test('Templates category chips scroll in one row instead of wrapping', async ({ page }) => {+ await page.setViewportSize({ width: 320, height: 800 })+ await openEditorPanel(page, 'Templates')+ const chips = page.locator('aside .cv-tabscroll').first()+ await expect(chips).toBeVisible()+ const row = await chips.evaluate((el) => {+ const kids = [...el.children].map((k) => Math.round(k.getBoundingClientRect().y))+ return { ys: [...new Set(kids)], sw: el.scrollWidth, cw: el.clientWidth }+ })+ expect(row.ys).toHaveLength(1)+ expect(row.sw).toBeGreaterThanOrEqual(row.cw)+})