diff --git a/src/presentation/styles/theme/base.css b/src/presentation/styles/theme/base.css index 3c2a3d82..b0ecc0e6 100644 --- a/src/presentation/styles/theme/base.css +++ b/src/presentation/styles/theme/base.css @@ -11,6 +11,15 @@ min-height: 100vh; } + /* 08-06. Korean breaks between words, not between syllables. A word too + long for its box still wraps. `break-word`, not `anywhere`: `anywhere` + also shrinks min-content, so a squeezed flex item (a header button) + would split its label again. */ + :lang(ko) { + word-break: keep-all; + overflow-wrap: break-word; + } + button, input, textarea, diff --git a/tests/e2e/typography.spec.ts b/tests/e2e/typography.spec.ts index 3fa3cfe3..fa707b6a 100644 --- a/tests/e2e/typography.spec.ts +++ b/tests/e2e/typography.spec.ts @@ -31,3 +31,18 @@ test("steps heading size and weight down from h2 to body copy", async ({ expect(scale.h2.weight).toBeGreaterThan(scale.body.weight); expect(scale.h3.weight).toBeGreaterThan(scale.body.weight); }); + +// 08-06. The browser default breaks Korean between any two syllables, so a +// button read "로그 / 인". Korean text breaks between words; a single word +// longer than its box still wraps instead of overflowing. +test("breaks Korean text between words, not inside them", async ({ page }) => { + await page.goto("/"); + await expect(page.locator("html")).toHaveAttribute("lang", "ko-KR"); + + const wrapping = await page.locator("body").evaluate((body) => { + const style = getComputedStyle(body); + return { wordBreak: style.wordBreak, overflowWrap: style.overflowWrap }; + }); + + expect(wrapping).toEqual({ wordBreak: "keep-all", overflowWrap: "break-word" }); +});