Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2024-05-19 - Missing ARIA Labels on Modal Close Buttons
**Learning:** Icon-only close buttons (like the 'X' in ProjectModal and ExperienceModal) were missing ARIA labels, making them inaccessible to screen readers.
**Action:** Always verify that icon-only buttons include descriptive `aria-label` attributes to ensure keyboard and screen reader accessibility.

## 2025-02-12 - Missing Keyboard Events on Motion Cards
**Learning:** In Framer Motion or interactive `div` elements used as cards (like `ProjectCard` and `ExperienceCard`), attaching an `onClick` handler isn't enough for keyboard accessibility. These elements do not natively receive focus or handle enter/space keypresses.
**Action:** When making non-interactive elements (like `div` or `motion.div`) act as buttons or links, always add `role="button"`, `tabIndex={0}`, `onKeyDown` (for Enter/Space), and `focus-visible` styling to provide focus indicators for keyboard navigation.
13 changes: 12 additions & 1 deletion frontend/src/components/ExperienceCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ import TechTag from "./TechTag";
import { cn } from "@/lib/utils";

export default function ExperienceCard({ experience, onClick }) {
const handleKeyDown = (e) => {
if (onClick && (e.key === "Enter" || e.key === " ")) {
e.preventDefault();
onClick(e);
}
};

return (
<motion.div
role="button"
tabIndex={0}
whileHover={{ x: 4 }}
whileTap={{ scale: 0.99 }}
transition={{ duration: 0.2 }}
Expand All @@ -17,9 +26,11 @@ export default function ExperienceCard({ experience, onClick }) {
"rounded-xl overflow-hidden",
"transition-all duration-300",
"hover:border-[var(--color-border-secondary)]",
"hover:shadow-[0_10px_40px_-15px_var(--color-primary-dim)]"
"hover:shadow-[0_10px_40px_-15px_var(--color-primary-dim)]",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--color-background-primary)]"
)}
onClick={onClick}
onKeyDown={handleKeyDown}
>
{/* Current status indicator bar */}
{experience.status === "Current" && (
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/components/ProjectCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ export default function ProjectCard({ project, useModal = false, onModalClick, f
}
};

const handleKeyDown = (e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
handleCardClick();
}
};

const statusColors = {
Paused: { bg: "bg-yellow-500/10", text: "text-yellow-400", border: "border-yellow-500/30" },
Completed: { bg: "bg-[var(--color-primary-dim)]", text: "text-[var(--color-primary)]", border: "border-[var(--color-primary)]/30" },
Expand All @@ -29,10 +36,13 @@ export default function ProjectCard({ project, useModal = false, onModalClick, f

return (
<motion.div
role="button"
tabIndex={0}
whileHover={{ y: -4 }}
whileTap={{ scale: 0.99 }}
transition={{ duration: 0.3 }}
onClick={handleCardClick}
onKeyDown={handleKeyDown}
className={cn(
"group relative cursor-pointer h-full",
"bg-[var(--color-background-card)]",
Expand All @@ -41,6 +51,7 @@ export default function ProjectCard({ project, useModal = false, onModalClick, f
"transition-all duration-400",
"hover:border-[var(--color-border-secondary)]",
"hover:shadow-[0_20px_50px_-20px_var(--color-primary-dim)]",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--color-background-primary)]",
featured && "md:flex md:items-stretch"
)}
>
Expand Down