fix(a11y): 无障碍与 lint 修复(对比度/alt 属性/触控目标收窄)+ Geist 本地字体系统

This commit is contained in:
2026-08-31 12:03:32 +08:00
parent 0786af3db9
commit b65ddd1ff7
20 changed files with 125 additions and 76 deletions
+26 -1
View File
@@ -1,4 +1,5 @@
import type { Metadata, Viewport } from "next";
import localFont from "next/font/local";
import "./globals.css";
import { Suspense } from "react";
import { GoogleAnalyticsWrapper } from "@/components/analytics/GoogleAnalyticsWrapper";
@@ -18,6 +19,26 @@ import { SiteConfigProvider, type SiteConfig, type NavigationItem, type MegaDrop
import { COMPANY_INFO, BRAND_NARRATIVE, type BrandPillar } from "@/lib/constants/company";
import { NAVIGATION_V2, MEGA_DROPDOWN_DATA } from "@/lib/constants/navigation";
/**
* 拉丁字形使用 Geist(本地 woff2,无网络请求);
* 中文由 globals.css 的 --font-sans 回退到 PingFang SC / 微软雅黑。
* 这样英文数字有设计字体,中文又不需下载数 MB 的 CJK 字重。
* 两者总重 140KB,display: swap 不阻塞首屏。
*/
const geistSans = localFont({
src: "./fonts/geist-sans.woff2",
variable: "--font-geist-sans",
display: "swap",
preload: true,
});
const geistMono = localFont({
src: "./fonts/geist-mono.woff2",
variable: "--font-geist-mono",
display: "swap",
preload: false,
});
export const metadata: Metadata = {
metadataBase: new URL("https://www.novalon.cn"),
title: {
@@ -143,7 +164,11 @@ export default async function RootLayout({
};
return (
<html lang="zh-CN" className="scroll-smooth" suppressHydrationWarning>
<html
lang="zh-CN"
className={`scroll-smooth ${geistSans.variable} ${geistMono.variable}`}
suppressHydrationWarning
>
<head>
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />