fix: close final portfolio quality gaps
This commit is contained in:
@@ -2,7 +2,8 @@ import type { SectionId } from "@/content/types";
|
||||
import type { JourneySource } from "./types";
|
||||
|
||||
declare const __PORTFOLIO_TEST_BUILD__: boolean;
|
||||
const TEST_BUILD = typeof __PORTFOLIO_TEST_BUILD__ !== 'undefined' && __PORTFOLIO_TEST_BUILD__;
|
||||
const TEST_BUILD =
|
||||
typeof __PORTFOLIO_TEST_BUILD__ !== "undefined" && __PORTFOLIO_TEST_BUILD__;
|
||||
|
||||
export interface NavigationState {
|
||||
epoch: number;
|
||||
@@ -80,7 +81,7 @@ export function validateSectionAnchor(
|
||||
const target = document.getElementById(id);
|
||||
if (!(target instanceof HTMLElement) || target.id !== id) return null;
|
||||
const heading = target.querySelector<HTMLElement>(
|
||||
':scope > h2[tabindex="-1"]',
|
||||
'h1[tabindex="-1"], h2[tabindex="-1"]',
|
||||
);
|
||||
return heading === null ? null : { id, target };
|
||||
}
|
||||
@@ -94,7 +95,7 @@ const browserRuntime = (): NavigationRuntime => ({
|
||||
target.scrollIntoView({ behavior, block: "start" }),
|
||||
focusHeading: (target) => {
|
||||
target
|
||||
.querySelector<HTMLElement>(':scope > h2[tabindex="-1"]')
|
||||
.querySelector<HTMLElement>('h1[tabindex="-1"], h2[tabindex="-1"]')
|
||||
?.focus({ preventScroll: true });
|
||||
},
|
||||
getScrollY: () => window.scrollY,
|
||||
@@ -165,8 +166,13 @@ export function createNavigationController(
|
||||
source,
|
||||
destinationId,
|
||||
};
|
||||
if (TEST_BUILD) window.__PORTFOLIO_PERFORMANCE__?.noteNavigationEpoch(currentState.epoch);
|
||||
if (TEST_BUILD && source === 'explicit-navigation' && (destinationId === 'toolkit' || destinationId === 'contact')) {
|
||||
if (TEST_BUILD)
|
||||
window.__PORTFOLIO_PERFORMANCE__?.noteNavigationEpoch(currentState.epoch);
|
||||
if (
|
||||
TEST_BUILD &&
|
||||
source === "explicit-navigation" &&
|
||||
(destinationId === "toolkit" || destinationId === "contact")
|
||||
) {
|
||||
window.__PORTFOLIO_PERFORMANCE__?.recordActionMutation(destinationId);
|
||||
}
|
||||
emit();
|
||||
@@ -191,7 +197,11 @@ export function createNavigationController(
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (TEST_BUILD && window.__PORTFOLIO_PERFORMANCE__?.holdNavigationSettlement(epoch)) return;
|
||||
if (
|
||||
TEST_BUILD &&
|
||||
window.__PORTFOLIO_PERFORMANCE__?.holdNavigationSettlement(epoch)
|
||||
)
|
||||
return;
|
||||
cancelSettle();
|
||||
frameId = runtime.requestFrame(() => {
|
||||
frameId = undefined;
|
||||
@@ -210,7 +220,8 @@ export function createNavigationController(
|
||||
id: SectionId,
|
||||
target: HTMLElement,
|
||||
): void => {
|
||||
if (TEST_BUILD) window.__PORTFOLIO_PERFORMANCE__?.registerNavigationSettlement(epoch);
|
||||
if (TEST_BUILD)
|
||||
window.__PORTFOLIO_PERFORMANCE__?.registerNavigationSettlement(epoch);
|
||||
settleTimerId = runtime.setTimer(() => {
|
||||
settleTimerId = undefined;
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user