Skip to content

Commit 054e487

Browse files
Address Sara third PR feedback item
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b95c5ed commit 054e487

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

components/attack-surface/AttackSurfaceDashboard.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState, useCallback, useEffect, useMemo } from "react";
1+
import { useState, useCallback, useEffect, useMemo, useRef } from "react";
22
import { threatVectors, severityMeta, type PostureState, type ThreatVector } from "./threatData";
33
import "./AttackSurface.css";
44

@@ -282,9 +282,19 @@ function DetailCard({
282282
onClose: () => void;
283283
}) {
284284
const sev = severityMeta[vector.severity];
285+
const cardRef = useRef<HTMLDivElement>(null);
286+
287+
useEffect(() => {
288+
if (!cardRef.current) return;
289+
const prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
290+
cardRef.current.scrollIntoView({
291+
behavior: prefersReducedMotion ? "auto" : "smooth",
292+
block: "nearest",
293+
});
294+
}, [vector.id]);
285295

286296
return (
287-
<div className="as-detail">
297+
<div className="as-detail" ref={cardRef}>
288298
<div className="as-detail-top">
289299
<div className="as-detail-left">
290300
<h3 className="as-detail-title">{vector.title}</h3>

0 commit comments

Comments
 (0)