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
5 changes: 5 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@

**Learning:** For icon-only buttons, applying `aria-label` to the button is necessary for screen readers, but the inner SVG icon must also include `aria-hidden="true"` to prevent redundant or confusing announcements.
**Action:** Always pair an `aria-label` on an icon-only `<button>` with an `aria-hidden="true"` attribute on its inner `<svg>` or `<LucideIcon>`.

## 2024-05-18 - Proper State Conveyance & Focus for Custom Controls

**Learning:** Custom toggle buttons (like "On/Off" switches) require `aria-pressed={boolean}` to correctly announce their current state to screen readers. Furthermore, `<input type="range">` elements need an explicit `aria-label` when their visual label is not formally linked via `htmlFor`. Finally, elements that rely on `focus-visible` for keyboard accessibility must explicitly declare `focus-visible:outline-none` when applying custom focus rings to avoid double-rendering browser default outlines.
**Action:** When implementing custom toggles, always apply `aria-pressed`. Ensure range inputs have accessible names via `aria-label`. Always pair `focus-visible:ring-*` with `focus-visible:outline-none`.
Comment on lines +8 to +9

@cubic-dev-ai cubic-dev-ai Bot Jun 30, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Do not state that On/Off switches require aria-pressed; switches should use aria-checked (or a native checkbox), while only toggle buttons use aria-pressed. This guidance could lead future accessibility fixes to implement incorrect ARIA semantics.

Prompt for AI agents
Check if this issue is valid β€” if so, understand the root cause and fix it. At .Jules/palette.md, line 8:

<comment>Do not state that On/Off switches require `aria-pressed`; switches should use `aria-checked` (or a native checkbox), while only toggle buttons use `aria-pressed`. This guidance could lead future accessibility fixes to implement incorrect ARIA semantics.</comment>

<file context>
@@ -2,3 +2,8 @@
+
+## 2024-05-18 - Proper State Conveyance & Focus for Custom Controls
+
+**Learning:** Custom toggle buttons (like "On/Off" switches) require `aria-pressed={boolean}` to correctly announce their current state to screen readers. Furthermore, `<input type="range">` elements need an explicit `aria-label` when their visual label is not formally linked via `htmlFor`. Finally, elements that rely on `focus-visible` for keyboard accessibility must explicitly declare `focus-visible:outline-none` when applying custom focus rings to avoid double-rendering browser default outlines.
+**Action:** When implementing custom toggles, always apply `aria-pressed`. Ensure range inputs have accessible names via `aria-label`. Always pair `focus-visible:ring-*` with `focus-visible:outline-none`.
</file context>
Suggested change
**Learning:** Custom toggle buttons (like "On/Off" switches) require `aria-pressed={boolean}` to correctly announce their current state to screen readers. Furthermore, `<input type="range">` elements need an explicit `aria-label` when their visual label is not formally linked via `htmlFor`. Finally, elements that rely on `focus-visible` for keyboard accessibility must explicitly declare `focus-visible:outline-none` when applying custom focus rings to avoid double-rendering browser default outlines.
**Action:** When implementing custom toggles, always apply `aria-pressed`. Ensure range inputs have accessible names via `aria-label`. Always pair `focus-visible:ring-*` with `focus-visible:outline-none`.
**Learning:** Custom toggle buttons require `aria-pressed={boolean}` to correctly announce their current state to screen readers; controls implemented as switches should instead use native checkbox semantics or `role="switch"` with `aria-checked`. Furthermore, `<input type="range">` elements need an explicit `aria-label` when their visual label is not formally linked via `htmlFor`. Finally, elements that rely on `focus-visible` for keyboard accessibility must explicitly declare `focus-visible:outline-none` when applying custom focus rings to avoid double-rendering browser default outlines.
**Action:** When implementing custom toggles, apply `aria-pressed` only to button-style toggle buttons; use `aria-checked`/native checkbox semantics for switches. Ensure range inputs have accessible names via `aria-label`. Always pair `focus-visible:ring-*` with `focus-visible:outline-none`.
Fix with cubic

8 changes: 6 additions & 2 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,6 @@
"title": "MCP API Key",
"description": "Generate an API key to save prompts via MCP and access your private prompts.",
"yourApiKey": "Your API Key",

"keyWarning": "Keep this key secret. Anyone with this key can access your private prompts and create prompts on your behalf.",
"noApiKey": "You haven't generated an API key yet.",
"generate": "Generate API Key",
Expand Down Expand Up @@ -1765,7 +1764,12 @@
"resetWarning": "This will delete all your stars and progress. Are you sure?",
"resetConfirm": "Yes, Reset Everything",
"resetComplete": "Progress reset! Reloading...",
"cancel": "Cancel"
"cancel": "Cancel",
"muteMusic": "Mute music",

@cubic-dev-ai cubic-dev-ai Bot Jun 30, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Add the new kids.settings translation keys to all locale files, not just English. Otherwise non-English Kids Mode renders these new controls with missing translations/errors instead of localized accessible labels.

Prompt for AI agents
Check if this issue is valid β€” if so, understand the root cause and fix it. At messages/en.json, line 1768:

<comment>Add the new kids.settings translation keys to all locale files, not just English. Otherwise non-English Kids Mode renders these new controls with missing translations/errors instead of localized accessible labels.</comment>

<file context>
@@ -1765,7 +1764,12 @@
       "resetComplete": "Progress reset! Reloading...",
-      "cancel": "Cancel"
+      "cancel": "Cancel",
+      "muteMusic": "Mute music",
+      "playMusic": "Play music",
+      "musicOn": "πŸ”Š On",
</file context>
Fix with cubic

"playMusic": "Play music",
"musicOn": "πŸ”Š On",
"musicOff": "πŸ”‡ Off",
"musicVolume": "Music volume"
}
}
}
11 changes: 9 additions & 2 deletions prisma.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
import "dotenv/config";
import { defineConfig } from "prisma/config";

if (!process.env.DATABASE_URL) {
process.env.DATABASE_URL = "postgresql://placeholder:placeholder@localhost:5432/placeholder";
}

if (!process.env.DIRECT_URL) {
process.env.DIRECT_URL = "postgresql://placeholder:placeholder@localhost:5432/placeholder";

@cubic-dev-ai cubic-dev-ai Bot Jun 30, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Do not fall back DIRECT_URL to an unrelated placeholder when DATABASE_URL is configured; migration commands may target localhost instead of the intended database. Use DATABASE_URL as the DIRECT_URL fallback, or fail fast for migration commands.

Prompt for AI agents
Check if this issue is valid β€” if so, understand the root cause and fix it. At prisma.config.ts, line 11:

<comment>Do not fall back DIRECT_URL to an unrelated placeholder when DATABASE_URL is configured; migration commands may target localhost instead of the intended database. Use DATABASE_URL as the DIRECT_URL fallback, or fail fast for migration commands.</comment>

<file context>
@@ -3,14 +3,21 @@
+}
+
+if (!process.env.DIRECT_URL) {
+  process.env.DIRECT_URL = "postgresql://placeholder:placeholder@localhost:5432/placeholder";
+}
+
</file context>
Suggested change
process.env.DIRECT_URL = "postgresql://placeholder:placeholder@localhost:5432/placeholder";
process.env.DIRECT_URL = process.env.DATABASE_URL;
Fix with cubic

}

export default defineConfig({
schema: "prisma/schema.prisma",
migrations: {
path: "prisma/migrations",
},
engine: "classic",
datasource: {
url:
process.env.DATABASE_URL ?? "postgresql://placeholder:placeholder@localhost:5432/placeholder",
url: process.env.DATABASE_URL,
},
});
16 changes: 11 additions & 5 deletions src/components/kids/layout/background-music.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ export function MusicButton() {
return (
<button
onClick={toggleMusic}
className="pixel-btn pixel-btn-amber flex h-8 items-center px-2 py-1.5"
className="pixel-btn pixel-btn-amber flex h-8 items-center px-2 py-1.5 focus-visible:ring-2 focus-visible:ring-[#8B4513] focus-visible:ring-offset-2 focus-visible:outline-none"
aria-label={labelText}
aria-pressed={isPlaying}

@cubic-dev-ai cubic-dev-ai Bot Jun 30, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: aria-pressed is being added to buttons whose accessible names change with state. Keep a stable label for toggle buttons, or omit aria-pressed when the action label changes.

Prompt for AI agents
Check if this issue is valid β€” if so, understand the root cause and fix it. At src/components/kids/layout/background-music.tsx, line 180:

<comment>`aria-pressed` is being added to buttons whose accessible names change with state. Keep a stable label for toggle buttons, or omit `aria-pressed` when the action label changes.</comment>

<file context>
@@ -175,8 +175,9 @@ export function MusicButton() {
-      className="pixel-btn pixel-btn-amber flex h-8 items-center px-2 py-1.5"
+      className="pixel-btn pixel-btn-amber flex h-8 items-center px-2 py-1.5 focus-visible:ring-2 focus-visible:ring-[#8B4513] focus-visible:ring-offset-2 focus-visible:outline-none"
       aria-label={labelText}
+      aria-pressed={isPlaying}
       title={labelText}
     >
</file context>
Fix with cubic

title={labelText}
>
{isPlaying ? <PixelSpeakerOn aria-hidden="true" /> : <PixelSpeakerOff aria-hidden="true" />}
Expand All @@ -187,6 +188,7 @@ export function MusicButton() {
// Volume slider component for settings
export function MusicVolumeSlider() {
const context = useMusicContext();
const t = useTranslations("kids.settings");

if (!context) return null;

Expand All @@ -197,21 +199,25 @@ export function MusicVolumeSlider() {
<div className="flex items-center justify-between">
<button
onClick={() => setIsPlaying(!isPlaying)}
className={`rounded-lg px-3 py-1.5 text-sm font-medium transition-colors ${
aria-pressed={isPlaying}
className={`rounded-lg px-3 py-1.5 text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-[#8B4513] focus-visible:ring-offset-2 focus-visible:outline-none ${
isPlaying ? "bg-[#22C55E] text-white" : "bg-gray-200 text-gray-600"
}`}
>
{isPlaying ? "πŸ”Š On" : "πŸ”‡ Off"}
{isPlaying ? t("musicOn") : t("musicOff")}
</button>
<span className="text-sm text-[#5D4037]">{Math.round(volume * 100)}%</span>
<span className="text-sm text-[#5D4037]" aria-hidden="true">
{Math.round(volume * 100)}%
</span>
</div>
<input
type="range"
min="0"
max="100"
value={volume * 100}
onChange={(e) => setVolume(parseInt(e.target.value) / 100)}
className="h-2 w-full cursor-pointer appearance-none rounded-lg bg-[#D4A574] accent-[#8B4513]"
aria-label={t("musicVolume")}
className="h-2 w-full cursor-pointer appearance-none rounded-lg bg-[#D4A574] accent-[#8B4513] focus-visible:ring-2 focus-visible:ring-[#8B4513] focus-visible:ring-offset-2 focus-visible:outline-none"
/>
</div>
);
Expand Down
Loading