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(homepage): align design focus flag with rounded exit progress (RX-198)
Amruth Pillaie6a5e0f1b68f
diff --git a/apps/web/src/features/homepage/scroll.test.tsx b/apps/web/src/features/homepage/scroll.test.tsxindex 3983ba331..10c709715 100644--- a/apps/web/src/features/homepage/scroll.test.tsx+++ b/apps/web/src/features/homepage/scroll.test.tsx@@ -79,9 +79,10 @@ describe("scroll engine", () => {expect(check.style.getPropertyValue("--out")).toBe("1.000");expect(tailor.style.getPropertyValue("--out")).toBe("");- rects.set(String(SCENE.design), { top: 0, bottom: 300, height: 900 });+ // Raw 0.6596 rounds to the same 0.660 the heading uses, so the link must already be exiting.+ rects.set(String(SCENE.design), { top: 0, bottom: 306.36, height: 900 });fireEvent.scroll(window);- await waitFor(() => expect(design.style.getPropertyValue("--out")).toBe("0.667"));+ await waitFor(() => expect(design.style.getPropertyValue("--out")).toBe("0.660"));expect(useLanding.getState().designExiting).toBe(true);rects.set(String(SCENE.design), { top: 0, bottom: 600, height: 900 });diff --git a/apps/web/src/features/homepage/scroll.ts b/apps/web/src/features/homepage/scroll.tsindex 39584f8ea..67d553589 100644--- a/apps/web/src/features/homepage/scroll.ts+++ b/apps/web/src/features/homepage/scroll.ts@@ -301,9 +301,9 @@ export function useScrollScenes(root: RefObject<HTMLElement | null>) {const pinned = section.dataset.pin !== undefined;progress[index] = reduced ? 1 : sectionProgress(rect.top, rect.height, viewportHeight, pinned);if (pinned) {- const exit = sectionExitProgress(rect.bottom, viewportHeight);- if (index === SCENE.design) designExiting = exit >= DESIGN_EXIT_AT;- const value = exit.toFixed(3);+ // The heading's fade reads the rounded value, so the focus flag must use the same frame of reference.+ const value = sectionExitProgress(rect.bottom, viewportHeight).toFixed(3);+ if (index === SCENE.design) designExiting = Number(value) >= DESIGN_EXIT_AT;if (writtenExit.get(section) !== value) exits.push({ section, value });}if (rect.top <= viewportHeight / 2 && rect.bottom > viewportHeight / 2) activeScene = index;