Skip to content

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!

fix(homepage): keep design link focusable until its heading fades (RX-198)

Amruth Pillai9bba8ab56802
diff --git a/apps/web/src/features/homepage/scroll.test.tsx b/apps/web/src/features/homepage/scroll.test.tsx
index ab2e985ef..3983ba331 100644
--- a/apps/web/src/features/homepage/scroll.test.tsx
+++ b/apps/web/src/features/homepage/scroll.test.tsx
@@ -38,7 +38,7 @@ describe("scroll engine", () => {
it("writes exit progress on pinned scenes and reports when Design hands its heading off", async () => {
const rects = new Map<string, { top: number; bottom: number; height: number }>([
- [String(SCENE.design), { top: 0, bottom: 300, height: 900 }],
+ [String(SCENE.design), { top: 0, bottom: 315, height: 900 }],
[String(SCENE.check), { top: 0, bottom: 0, height: 900 }],
]);
vi.stubGlobal("innerHeight", 900);
@@ -74,12 +74,16 @@ describe("scroll engine", () => {
const tailor = document.querySelector<HTMLElement>(`[data-scene="${SCENE.tailor}"]`);
if (!design || !check || !tailor) throw new Error("The scene harness did not render.");
- await waitFor(() => expect(design.style.getPropertyValue("--out")).toBe("0.667"));
- expect(design.style.getPropertyValue("--out")).toBe("0.667");
+ await waitFor(() => expect(design.style.getPropertyValue("--out")).toBe("0.650"));
+ expect(useLanding.getState().designExiting).toBe(false);
expect(check.style.getPropertyValue("--out")).toBe("1.000");
- expect(useLanding.getState().designExiting).toBe(true);
expect(tailor.style.getPropertyValue("--out")).toBe("");
+ rects.set(String(SCENE.design), { top: 0, bottom: 300, height: 900 });
+ fireEvent.scroll(window);
+ await waitFor(() => expect(design.style.getPropertyValue("--out")).toBe("0.667"));
+ expect(useLanding.getState().designExiting).toBe(true);
+
rects.set(String(SCENE.design), { top: 0, bottom: 600, height: 900 });
fireEvent.scroll(window);
await waitFor(() => expect(design.style.getPropertyValue("--out")).toBe("0.333"));
diff --git a/apps/web/src/features/homepage/scroll.ts b/apps/web/src/features/homepage/scroll.ts
index 833af75b7..39584f8ea 100644
--- a/apps/web/src/features/homepage/scroll.ts
+++ b/apps/web/src/features/homepage/scroll.ts
@@ -76,8 +76,8 @@ const PREPARE_STEPS = [0.19, 0.36, 0.53, 0.7, 0.84];
const smoothstep = (value: number) => value * value * (3 - 2 * value);
-/** Where Design's closing heading starts fading out of the scene, and where its link stops taking focus. */
-const DESIGN_EXIT_AT = 0.6;
+/** Where Design's closing heading has fully faded out of the scene, and where its link stops taking focus. */
+const DESIGN_EXIT_AT = 0.66;
/**
* How dark Share's sky is, from 0 to 1: night falls over the scene's first fifth and lifts into dawn over its last