From 0b989bd681c125fb81b6c88141a0d051f11289d9 Mon Sep 17 00:00:00 2001 From: SaladDay Date: Wed, 1 Jul 2026 08:23:14 +0000 Subject: [PATCH] fix(usage): keep date-range picker calendar on-screen in narrow popovers The custom date-range picker switched to its two-column layout (date fields | calendar) based on the viewport width via Tailwind `sm:` (640px). But the popover is clamped to `100vw - 2rem` and anchored to its trigger with `align="end"`, so its actual available width is not the viewport width. On narrow windows the wide two-column layout could activate while the popover only had room for one column, pushing the calendar column off the right edge of the window where it was clipped and unusable (month header and 4 of 7 weekday columns cut off). Gate the two-column layout on the popover's own inline size via a CSS container query instead of the viewport, and let the popover width shrink to fit the viewport. When the popover is genuinely wide it shows two columns; when it is clamped narrow it stacks vertically so the calendar stays fully visible. The base stacked layout is the safe fallback for engines without container-query support. Closes #4669 --- src/components/usage/UsageDateRangePicker.tsx | 8 ++--- src/index.css | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/components/usage/UsageDateRangePicker.tsx b/src/components/usage/UsageDateRangePicker.tsx index 845795a65..86266d9ca 100644 --- a/src/components/usage/UsageDateRangePicker.tsx +++ b/src/components/usage/UsageDateRangePicker.tsx @@ -331,7 +331,7 @@ export function UsageDateRangePicker({ {/* Preset shortcuts */} @@ -353,9 +353,9 @@ export function UsageDateRangePicker({ ))} -
+
{/* Left: date fields */} -
+

{t("usage.customRangeHint", "支持日期与时间,最长 30 天")}

@@ -403,7 +403,7 @@ export function UsageDateRangePicker({
{/* Right: calendar */} -
+
{/* Month navigation */}