A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
fix: match section chevron timing to its panel
Amruth Pillai58e297c64d8c
diff --git a/apps/web/src/features/resume/editor/write/section-row.tsx b/apps/web/src/features/resume/editor/write/section-row.tsxindex d06e862bc..75f3ac6bc 100644--- a/apps/web/src/features/resume/editor/write/section-row.tsx+++ b/apps/web/src/features/resume/editor/write/section-row.tsx@@ -180,11 +180,9 @@ export function SectionRow({ section, locked, dragGroup, onMove, children }: Secicon="caret-down"label={open ? t`Close ${title}` : t`Open ${title}`}size="icon-sm"- // Closing turns back as fast as the panel collapses (70% of the standard duration), not after it.- className={cn(- "text-ink-2 transition-transform duration-standard ease-enter",- open ? "rotate-180" : "duration-[calc(var(--d2)*0.7)]",- )}+ // Keep the panel's timing above the primitive's duration-quick utility.+ className={cn("text-ink-2 transition-transform ease-enter", open && "rotate-180")}+ style={{ transitionDuration: open ? "var(--d2)" : "calc(var(--d2) * 0.7)" }}onClick={() => setOpen(section.id, !open)}/>{!locked && <SectionMenu section={section} title={title} onMove={onMove} />}diff --git a/tests/e2e/specs/section-motion.spec.ts b/tests/e2e/specs/section-motion.spec.tsnew file mode 100644index 000000000..3935c68b1--- /dev/null+++ b/tests/e2e/specs/section-motion.spec.ts@@ -0,0 +1,66 @@+import type { Locator } from "@playwright/test";+import { createSampleResumeFromDashboard } from "../fixtures/resume";+import { expect, test } from "../fixtures/test";++async function timing(row: Locator) {+ return row.evaluate(async (element) => {+ await new Promise<void>((resolve) => requestAnimationFrame(() => requestAnimationFrame(() => resolve())));+ const button = element.querySelector<HTMLButtonElement>(+ 'button[aria-label="Open Education"], button[aria-label="Close Education"]',+ );+ const panel = element.querySelector<HTMLElement>('[data-slot="collapsible-content"]');+ if (!button) throw new Error("Education toggle is missing.");+ return {+ chevron: Number.parseFloat(getComputedStyle(button).transitionDuration),+ panel: panel ? Number.parseFloat(getComputedStyle(panel).transitionDuration) : null,+ heightAnimations:+ panel+ ?.getAnimations()+ .flatMap((animation) =>+ animation instanceof CSSTransition && animation.transitionProperty === "height"+ ? [Number(animation.effect?.getTiming().duration)]+ : [],+ ) ?? [],+ };+ });+}++for (const reducedMotion of ["no-preference", "reduce"] as const)+ test(`section chevron follows panel timing with motion=${reducedMotion}`, async ({ authPage: page }, info) => {+ await page.setViewportSize({ width: 1440, height: 1000 });+ await page.emulateMedia({ reducedMotion });+ await createSampleResumeFromDashboard(page, info);+ const row = page.locator("#sidebar-education");+ const title = row.getByRole("button", { name: "Education", exact: true });+ const open = row.getByRole("button", { name: "Open Education", exact: true });+ await open.click();+ await expect(title).toHaveAttribute("aria-expanded", "true");+ const opening = await timing(row);+ await expect+ .poll(() =>+ row.locator('[data-slot="collapsible-content"]').evaluate((element) => element.getAnimations().length),+ )+ .toBe(0);+ const close = row.getByRole("button", { name: "Close Education", exact: true });+ await close.focus();+ await page.keyboard.press("Enter");+ await expect(title).toHaveAttribute("aria-expanded", "false");+ await expect(open).toBeFocused();+ const closing = await timing(row);+ await info.attach("section-timing", {+ body: JSON.stringify({ reducedMotion, opening, closing }),+ contentType: "application/json",+ });+ if (reducedMotion === "reduce") {+ expect(opening.chevron).toBeLessThanOrEqual(0.001);+ expect(closing.chevron).toBeLessThanOrEqual(0.001);+ await expect(row.locator('[data-slot="collapsible-content"]')).toBeHidden();+ } else {+ expect(opening.chevron).toBeCloseTo(0.2);+ expect(opening.panel).toBeCloseTo(0.2);+ expect(closing.chevron).toBeCloseTo(0.14);+ expect(closing.panel).toBeCloseTo(0.14);+ expect(closing.heightAnimations).toHaveLength(1);+ expect(closing.heightAnimations[0]).toBeCloseTo(140);+ }+ });