fix(css): cross-engine parity ให้ Firefox ใกล้ Chromium

- เพิ่ม scrollbar-width/scrollbar-color (::-webkit-scrollbar ใช้กับ Chromium/Safari เท่านั้น)
- color-scheme: dark บน html → select/สกรอลบาร์/ฟอร์มเนทีฟเป็นโทนเข้มทั้งสองเอนจิน
- ::selection สีแบรนด์ #A92626 (เดิมสีฟ้าตาม OS คนละเฉด)
- ::-moz-focus-inner reset กัน padding ภายในปุ่มที่ Firefox ใส่เอง
- -webkit-mask-image คู่กับ mask-image (Safari)
- ลด backdrop-blur hero 32px → 24px (budget ตาม DESIGN.md, FF แพงกว่ามาก)
- DESIGN.md: หัวข้อ Cross-engine parity · sw VERSION v2.0.2
This commit is contained in:
Bkk1234 committed 2026-11-14 13:07:04 +07:00
1 parent 319c271d23
commit 301ad22a39
5 files changed
+49 -3

No files matched your search

+15 -1
View File
@@ -80,7 +80,6 @@ part of that build, not leave them as an empty template.
- hover ของการ์ดใช้ `translate` (Tailwind `hover:-translate-y-1`) ไม่ใช้ `transform` เพราะชนกับ keyframe ของ reveal · ทุกอนิเมชันต้องมีคู่มือปิดใน `@media (prefers-reduced-motion: reduce)`
## PWA & accessibility contract (บังคับ)
- **ติดตั้งได้**: `<link rel="manifest">` อยู่ใน `app/root.tsx` (ห้ามลบ) · `public/manifest.json` ต้องมี `display: standalone`, `id`, `scope`, `start_url: "/"`, `lang` และไอคอน **PNG** 192/512 + maskable 512 (Chrome ไม่รับ SVG, iOS ไม่รับ SVG) · `apple-touch-icon` ต้องชี้ `icon-180.png`
- **ไอคอน**: ไฟล์จริงคือ `public/icon-192.png` / `icon-512.png` / `icon-maskable-512.png` / `icon-180.png` (สร้างจาก PNG 1024 ที่ฝังอยู่ใน `icon-512.svg`) — SVG เดิมเหลือไว้เป็น favicon เท่านั้น
- **service worker**: `public/sw.js` — หน้าเว็บ network-first (ออฟไลน์ → แคชหน้า → `offline.html`), static cache-first + revalidate เบื้องหลัง, ไม่แคช `/api/*` และไม่แตะ `/app/*` `/node_modules/*` `/@*` (โมดูล dev) · ลงทะเบียนผ่าน `app/lib/pwa.ts` + `<ServiceWorkerSetup/>` ใน `root.tsx`
@@ -89,6 +88,21 @@ part of that build, not leave them as an empty template.
- **contrast ที่วัดจริง** (พื้น `#0D0D0D`): `#B3B3B3` 9.27 · `#D47272` 5.97 · **`#A92626` = 2.77 → ห้ามใช้กับตัวอักษร** (ใช้ได้เฉพาะเส้นขอบ/พื้น) · placeholder ช่องค้นหาใช้ `#8A8A8A` (4.77 บน `#1F1F1F`) ไม่ใช่ `#454545` (1.72)
- **hit area ≥ 44px**: ปุ่มที่หน้าตาเล็กกว่า (ใกล้ฉัน 20px, TH/EN 26px, chip 38px, ลูกศรแกลเลอรี 40px) ขยายด้วย `after:absolute after:-inset-*` — ห้ามเปลี่ยนความสูงที่มองเห็นเพื่อเพิ่ม hit area
## Cross-engine parity (Chromium / Firefox) — บังคับ
เป้าหมาย: **Firefox ต้องดูและรู้สึกใกล้ Chromium ที่สุด** โดยไม่ต้องมี build แยก
- **สกรอลบาร์**: Chromium/Safari ใช้ `::-webkit-scrollbar` (5px, `--muted-foreground/0.22`) · Firefox ไม่รู้จัก → ต้องมี `scrollbar-width: thin` + `scrollbar-color` คู่กันเสมอ (ตอนนี้ประกาศที่ `*` ใน `global.css`) · ห้ามลบฝั่งใดฝั่งหนึ่ง
- **`color-scheme: dark` บน `<html>`** — ทำให้ select/scrollbar/ฟอร์มเนทีฟ/autofill เป็นโทนเข้มทั้งสองเอนจิน (ถ้าไม่มี Firefox จะได้ select ขาวสว่างกลางธีมดำ)
- **`::selection`** ต้องประกาศเอง (`#A92626` พื้น, ตัวอักษรขาว) — ไม่งั้นได้สีฟ้าตาม OS ซึ่งคนละเฉดในแต่ละเอนจิน
- **`::-moz-focus-inner`** reset (`border:0; padding:0`) สำหรับ `button`/`input` — Firefox ใส่ padding ภายในเองทำให้ปุ่มเตี้ย/กว้างต่างจาก Chromium เล็กน้อย
- **`mask-image`** ต้องมีทั้ง `-webkit-mask-image` (Safari) และ `mask-image` (Firefox/Chromium)
- **`<details>/<summary>`**: ซ่อน marker ด้วย `list-none` (Firefox ใช้ `list-style: none`) **และ** `[&::-webkit-details-marker]:hidden` (Chromium) — ต้องมีทั้งคู่
- **`backdrop-blur`**: งบไม่เกิน **24px** ต่อชั้น (เดิม hero ใช้ 32px) — `backdrop-filter` ของ Firefox แพงกว่ามากและทำให้เลื่อนกระตุก · ห้ามซ้อน blur หลายชั้นใน element เดียว
- **ห้ามใส่ `-webkit-font-smoothing`** — ไม่มีผลใน Firefox ทำให้เห็นความต่างชัดขึ้นแทนที่จะเท่ากัน (การเรนเดอร์ฟอนต์ไทยสองเอนจินไม่มีทางเท่ากัน 100% — ยอมรับ)
- **สิ่งที่ต่างโดยธรรมชาติและไม่ต้องแก้**: Firefox เดสก์ท็อปไม่มี `navigator.share` (fallback คัดลอกลิงก์ทำงานอยู่) · ไม่มี install prompt ของ PWA (`beforeinstallprompt` ไม่มี) · inertia การเลื่อนต่างกัน
- ทดสอบ: เปิดทั้งสองเบราว์เซอร์ที่หน้า `/`, `/cinema/<slug>`, `/for-cinemas`, `/admin` — ดูสกรอลบาร์/select/`<details>`/ปุ่มต้องหน้าตาเดียวกัน
## Agent-Native is structural, not visual
This shell already meets the Agent-Native contract: data in SQL, actions as the
+1 -1
View File
@@ -74,7 +74,7 @@ export function HeroSection({
<Reveal
delay={200}
className="w-full rounded-2xl border border-[#303030] bg-[#1B1B1B]/80 px-4 py-6 backdrop-blur-[32px] md:px-10"
className="w-full rounded-2xl border border-[#303030] bg-[#1B1B1B]/80 px-4 py-6 backdrop-blur-[24px] md:px-10"
>
<form
role="search"
+32
View File
@@ -146,6 +146,12 @@
}
.chat-sidebar-thread-title[data-overflow="true"] {
-webkit-mask-image: linear-gradient(
to right,
hsl(var(--foreground)) 0,
hsl(var(--foreground)) calc(100% - var(--chat-sidebar-title-fade)),
hsl(var(--foreground) / 0) 100%
);
mask-image: linear-gradient(
to right,
hsl(var(--foreground)) 0,
@@ -262,6 +268,32 @@
background: hsl(var(--muted-foreground) / 0.34);
}
/* ══ ความเท่ากันข้ามเอนจิน (Chromium / Firefox) ═══════════════════════════
ทุกอย่างในบล็อกนี้มีไว้เพื่อให้ Firefox ดู/ทำงานใกล้ Chromium ที่สุด
- `::-webkit-scrollbar` (ด้านบน) Firefox ไม่รู้จัก → ต้องมี scrollbar-width/color
- `color-scheme: dark` ทำให้ select/scrollbar/ฟอร์มเนทีฟเป็นโทนเข้มทั้งสองเอนจิน
- `::selection` ใช้สีแบรนด์แทนสีฟ้าเริ่มต้นของ OS (คนละสีในแต่ละเอนจิน)
- `::-moz-focus-inner` กันระยะขอบภายในปุ่มที่ Firefox ใส่เอง */
html {
color-scheme: dark;
}
* {
scrollbar-width: thin;
scrollbar-color: hsl(var(--muted-foreground) / 0.22) transparent;
}
::selection {
background-color: #a92626;
color: #ffffff;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/* ══ Motion — อนิเมชันเล็ก ๆ ตอนโหลด/เลื่อน ═══════════════════════════════
เปิดใช้เฉพาะเมื่อผู้ใช้ไม่ได้ขอ reduced motion: สคริปต์ใน <head> (root.tsx)
ใส่คลาส .fx-motion ให้ <html> ก่อน paint → ไม่กระพริบ และถ้าปิด JS ไว้
Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

+1 -1
View File
@@ -18,7 +18,7 @@
* | โดเมนอื่น (รูป hotlink) | ไม่จัดการ |
* | /app/* · /node_modules/* · /@* | ไม่จัดการ (โมดูลของ dev server) |
*/
const VERSION = "v2.0.1";
const VERSION = "v2.0.2";
const PAGES_CACHE = `alterflixhub-pages-${VERSION}`;
const ASSETS_CACHE = `alterflixhub-assets-${VERSION}`;