From 338822ab074b19194b0474e4c001ede93c2d55fb Mon Sep 17 00:00:00 2001 From: Sanaei Date: Sat, 15 Aug 2026 21:16:13 +0200 Subject: [PATCH] fix(sub): keep copy page within mobile viewport Constrain the copy-only subscription page to the dynamic viewport, wrap long localized text, and infer text direction so mobile browsers cannot render a horizontally shifted desktop-width page. Add regression coverage for the responsive layout contract. --- internal/sub/controller.go | 10 ++++++---- internal/sub/controller_browser_test.go | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/internal/sub/controller.go b/internal/sub/controller.go index 828eafc66..587a02c77 100644 --- a/internal/sub/controller.go +++ b/internal/sub/controller.go @@ -546,15 +546,17 @@ func (a *SUBController) serveSubscriptionCopyPage(c *gin.Context) { {{TITLE}} -
+

{{HEADING}}

{{INSTRUCTIONS}}

diff --git a/internal/sub/controller_browser_test.go b/internal/sub/controller_browser_test.go index a86474869..42f589cf6 100644 --- a/internal/sub/controller_browser_test.go +++ b/internal/sub/controller_browser_test.go @@ -105,6 +105,28 @@ func TestSubscriptionCopyPageUsesRequestLocale(t *testing.T) { } } +func TestSubscriptionCopyPageIsMobileSafe(t *testing.T) { + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + c.Request = httptest.NewRequest(http.MethodGet, "/sub/abc", nil) + + (&SUBController{}).serveSubscriptionCopyPage(c) + body := w.Body.String() + for _, required := range []string{ + ``, + `* { box-sizing: border-box; }`, + `min-height: 100dvh`, + `overflow-x: hidden`, + `overflow-wrap: anywhere`, + `@media (max-width: 480px)`, + `
`, + } { + if !strings.Contains(body, required) { + t.Fatalf("copy page is missing mobile layout constraint %q", required) + } + } +} + func TestExplicitSubPageRequest(t *testing.T) { gin.SetMode(gin.TestMode)