fix(ux-31): eliminate 13px horizontal viewport overflow and align MobileBottomNav with safe-area

This commit is contained in:
devops committed 2026-10-17 18:47:20 +00:00
1 parent f5c970f82e
commit 81d1fa816b
3 files changed
+38 -2

No files matched your search

+1 -1
View File
@@ -41,7 +41,7 @@
html, body {
font-family: var(--font-vazir), "Vazirmatn", sans-serif !important;
@apply bg-medical-gray-50 text-medical-gray-900 antialiased max-w-[100vw] overflow-x-hidden;
@apply bg-medical-gray-50 text-medical-gray-900 antialiased w-full max-w-full overflow-x-clip;
font-feature-settings: "ss01", "ss02", "cv01", "cv11";
}
@@ -505,7 +505,7 @@ export default function MobileBottomNav({
{/* 3. FIXED 5-TAB APP BOTTOM NAVIGATION BAR */}
<nav
aria-label="منوی ناوبری موبایل"
className="lg:hidden fixed bottom-0 inset-x-0 z-40 bg-white/95 backdrop-blur-md border-t border-medical-gray-200 shadow-[0_-4px_20px_rgba(0,0,0,0.06)] font-vazir"
className="lg:hidden fixed bottom-0 left-0 right-0 z-40 bg-white/95 backdrop-blur-md border-t border-medical-gray-200 shadow-[0_-4px_20px_rgba(0,0,0,0.06)] font-vazir pb-[env(safe-area-inset-bottom,0px)]"
dir="rtl"
>
<div className="max-w-md mx-auto px-2 h-16 flex items-center justify-between select-none">
@@ -0,0 +1,36 @@
import React from "react";
import { describe, it, expect, vi } from "vitest";
import { render } from "@testing-library/react";
// Mock next/navigation
vi.mock("next/navigation", () => ({
usePathname: () => "/",
useRouter: () => ({ push: vi.fn(), replace: vi.fn(), back: vi.fn() }),
useSearchParams: () => new URLSearchParams(),
}));
vi.mock("next/link", () => ({
default: ({ children, href, ...props }: any) => <a href={href} {...props}>{children}</a>,
}));
vi.mock("../../lib/store/cartStore", () => ({
useCartStore: (selector?: any) => {
const s = { getTotalItems: () => 0 };
return typeof selector === "function" ? selector(s) : s;
},
}));
import MobileBottomNav from "../MobileBottomNav";
describe("Viewport Overflow & BottomNav Positioning (UX-31)", () => {
it("ensures MobileBottomNav uses left-0 right-0 with safe-area padding to avoid 13px overflow on 360px viewports", () => {
const { container } = render(<MobileBottomNav />);
const nav = container.querySelector("nav");
expect(nav).not.toBeNull();
expect(nav?.className).toContain("fixed");
expect(nav?.className).toContain("bottom-0");
expect(nav?.className).toContain("left-0");
expect(nav?.className).toContain("right-0");
expect(nav?.className).toContain("pb-[env(safe-area-inset-bottom,0px)]");
});
});