fix calendar time label axis width

This commit is contained in:
callumalpass 2026-05-21 09:00:03 +10:00
parent 00f940c55d
commit b31486000f
3 changed files with 42 additions and 0 deletions

View file

@ -26,6 +26,8 @@ Example:
## Fixed
- (#1898) Fixed Calendar Day view time labels shifting into the middle of the grid after switching views.
- Thanks to @ddevaal for reporting and confirming the regression.
- (#1916) Fixed Markdown task links using Obsidian's generated filename label instead of the TaskNote title in the task link overlay.
- Thanks to @minchinweb for reporting.
- (#1911) Fixed recurrence choices starting from today instead of the selected calendar date when creating a task from Calendar view.

View file

@ -1081,6 +1081,7 @@
color: var(--text-muted);
padding: 0;
text-align: right;
width: 4rem;
}
.advanced-calendar-view .fc-timegrid-slot-label-frame {

View file

@ -0,0 +1,39 @@
/**
* Issue #1898: Calendar view time labels shifted to the center.
*
* The stale inline-width reset for FullCalendar slot labels must be paired with
* a fixed slot-label cell width. Without that CSS width, Day view can let the
* slot-label column expand to half of the calendar grid after the reset.
*/
import { describe, expect, it } from "@jest/globals";
import fs from "fs";
import path from "path";
const repoRoot = path.resolve(__dirname, "../../..");
function readRepoFile(relativePath: string): string {
return fs.readFileSync(path.join(repoRoot, relativePath), "utf-8");
}
function extractCssBlock(css: string, selector: string): string {
const escapedSelector = selector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const match = css.match(new RegExp(`${escapedSelector}\\s*\\{([^}]*)\\}`));
return match?.[1] ?? "";
}
describe("Issue #1898: Calendar time labels stay anchored to the axis", () => {
it("keeps reset slot labels on a fixed time-axis width", () => {
const source = readRepoFile("src/bases/CalendarView.ts");
const css = readRepoFile("styles/advanced-calendar-view.css");
const slotLabelBlock = extractCssBlock(
css,
".advanced-calendar-view .fc-timegrid-slot-label"
);
expect(source).toContain(".fc-timegrid-slot-label");
expect(slotLabelBlock).toContain("width: 4rem;");
expect(slotLabelBlock).toContain("text-align: right;");
});
});