fix(css): Safari/iOS parity + @layer base ให้ utility ยังชนะ

- iOS Safari: ฟอร์ม ≥16px บนมือถือ (กัน auto-zoom โดยไม่ต้องล็อก user-scalable), input[type=search] appearance:none, tap-highlight transparent, text-size-adjust 100%
- ย้ายบล็อก cross-engine เข้า @layer base — เดิม unlayered ทับ text-sm ทำให้ desktop เพี้ยนเป็น 16px
- admin 3 จุด min-h-screen → min-h-dvh
- DESIGN.md: ขยายหัวข้อเป็น Chromium/Firefox/Safari + กฎ @layer · sw VERSION v2.0.3
This commit is contained in:
Bkk1234 committed 2026-11-14 13:11:45 +07:00
1 parent 301ad22a39
commit 2eb625c8bc
7 files changed
+68 -37

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
* (ห้ามประกาศ inputClass/labelClass ซ้ำใน component)
*/
export const inputClass =
"w-full rounded-lg border border-[#303030] bg-[#141414] px-3 py-2 text-sm text-white outline-none transition focus:border-[#A92626] focus-visible:ring-2 focus-visible:ring-[#A92626]/40";
"w-full rounded-lg border border-[#303030] bg-[#141414] px-3 py-2 text-base text-white outline-none transition focus:border-[#A92626] focus-visible:ring-2 focus-visible:ring-[#A92626]/40 sm:text-sm";
export const labelClass = "flex flex-col gap-1.5 text-xs text-[#999]";
+1 -1
View File
@@ -90,7 +90,7 @@ export function HeroSection({
aria-label={messages.search.placeholder}
type="search"
enterKeyHint="search"
className="min-w-0 flex-1 bg-transparent text-sm text-white outline-none placeholder:text-[#8A8A8A] [&::-webkit-search-cancel-button]:hidden"
className="min-w-0 flex-1 bg-transparent text-base text-white outline-none placeholder:text-[#8A8A8A] md:text-sm [&::-webkit-search-cancel-button]:hidden"
/>
<button
type="button"
+50 -21
View File
@@ -268,30 +268,59 @@
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;
}
@layer base {
/* ══ ความเท่ากันข้ามเอนจิน (Chromium / Firefox / Safari) ══════════════════
อยู่ใน @layer base เพื่อให้ utility ของ Tailwind (เช่น `text-sm`) ยังชนะได้
ทุกอย่างในบล็อกนี้มีไว้เพื่อให้ Firefox และ Safari ดู/ทำงานใกล้ Chromium ที่สุด
- `::-webkit-scrollbar` (ด้านบน) Firefox ไม่รู้จัก → ต้องมี scrollbar-width/color
- `color-scheme: dark` ทำให้ select/scrollbar/ฟอร์มเนทีฟเป็นโทนเข้มทุกเอนจิน
- `::selection` ใช้สีแบรนด์แทนสีฟ้าเริ่มต้นของ OS (คนละสีในแต่ละเอนจิน)
- `::-moz-focus-inner` กันระยะขอบภายในปุ่มที่ Firefox ใส่เอง
- Safari/iOS: ตัดไฮไลต์เทาตอนแตะ, กันข้อความพองตอนหมุนจอ, ตัดสไตล์เนทีฟของช่องค้นหา */
html {
color-scheme: dark;
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
-webkit-tap-highlight-color: transparent;
}
* {
scrollbar-width: thin;
scrollbar-color: hsl(var(--muted-foreground) / 0.22) transparent;
}
* {
scrollbar-width: thin;
scrollbar-color: hsl(var(--muted-foreground) / 0.22) transparent;
}
::selection {
background-color: #a92626;
color: #ffffff;
}
::selection {
background-color: #a92626;
color: #ffffff;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/* iOS Safari ใส่กรอบ/มุมโค้งของตัวเองให้ช่องค้นหา — ตัดออกให้เหมือน desktop */
input[type="search"] {
-webkit-appearance: none;
appearance: none;
}
/* iOS Safari ซูมหน้าเมื่อโฟกัสช่องที่ font-size < 16px — ฟอร์มทุกตัวจึงใช้ 16px บนมือถือ
(ห้ามล็อกซูมด้วย user-scalable=no เพราะผิด WCAG 1.4.4) */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
font-size: 16px;
}
@media (min-width: 640px) {
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
font-size: inherit;
}
}
}
/* ══ Motion — อนิเมชันเล็ก ๆ ตอนโหลด/เลื่อน ═══════════════════════════════
+2 -2
View File
@@ -242,7 +242,7 @@ export default function AdminRoute() {
if (!store) {
return (
<div className="flex min-h-screen items-center justify-center bg-[#0D0D0D] text-sm text-[#999]">
<div className="flex min-h-dvh items-center justify-center bg-[#0D0D0D] text-sm text-[#999]">
กำลังโหลดข้อมูลหลังบ้าน…
</div>
);
@@ -252,7 +252,7 @@ export default function AdminRoute() {
const locales = store.site.locales;
return (
<div className="min-h-screen bg-[#0D0D0D] text-white">
<div className="min-h-dvh bg-[#0D0D0D] text-white">
<header className="sticky top-0 z-10 flex flex-wrap items-center justify-between gap-3 border-b border-[#242424] bg-[#0D0D0D]/95 px-6 py-4">
<div>
<h1 className="text-xl font-semibold">หลังบ้าน AlterFlixHub</h1>
+1 -1
View File
@@ -59,7 +59,7 @@ export default function AdminLoginRoute() {
}
return (
<div className="flex min-h-screen items-center justify-center bg-[#0D0D0D] px-5 text-white">
<div className="flex min-h-dvh items-center justify-center bg-[#0D0D0D] px-5 text-white">
<form
onSubmit={submit}
className="w-full max-w-sm rounded-2xl border border-[#303030] bg-[#141414] p-6"