From fd2cea8f477b8d20b645212e85f8ce92a4f2b04a Mon Sep 17 00:00:00 2001 From: valknarness Date: Fri, 7 Nov 2025 13:53:23 +0100 Subject: [PATCH] fix: resolve hydration errors in playground - Fix nested button error in color history by using div with role=button - Add keyboard accessibility (Enter/Space) to color history swatches - Add type guard for ColorInfo.name to handle object values - Add aria-label to remove button for better accessibility Fixes React hydration errors and improves accessibility. --- app/playground/page.tsx | 14 +++++++++++--- components/color/ColorInfo.tsx | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/playground/page.tsx b/app/playground/page.tsx index 458dcb3..75889b4 100644 --- a/app/playground/page.tsx +++ b/app/playground/page.tsx @@ -137,12 +137,19 @@ function PlaygroundContent() {
{recentColors.map((entry) => ( -
- + ))} diff --git a/components/color/ColorInfo.tsx b/components/color/ColorInfo.tsx index 08ea95a..e9b8bdc 100644 --- a/components/color/ColorInfo.tsx +++ b/components/color/ColorInfo.tsx @@ -80,7 +80,7 @@ export function ColorInfo({ info, className }: ColorInfoProps) {
Type
{info.is_light ? 'Light' : 'Dark'}
- {info.name && ( + {info.name && typeof info.name === 'string' && (
Named
{info.name}