Skip to content

feat: Add aria-labels to buttons for accessibility - #57

Open
rohitkumarnaidu wants to merge 5 commits into
itzzavdhesh:mainfrom
rohitkumarnaidu:fix-54
Open

feat: Add aria-labels to buttons for accessibility#57
rohitkumarnaidu wants to merge 5 commits into
itzzavdhesh:mainfrom
rohitkumarnaidu:fix-54

Conversation

@rohitkumarnaidu

@rohitkumarnaidu rohitkumarnaidu commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Closes #54

🚀 Program

ELUSOC

📝 Description

  • Added aria-label attributes to icon-only buttons across CenterCanvas, LeftSidebar, and Toast components to improve accessibility for screen readers.

🌱 Contributor Checklist

  • I am participating via ELUSOC
  • I have read the contribution guidelines
  • I checked for existing issues before creating this

Summary by cubic

Adds aria-labels to icon-only buttons and introduces a reusable useDarkMode hook with a toolbar toggle and saved preference. Improves accessibility and theme consistency, with system preference support.

  • New Features

    • Accessibility: aria-labels for icon-only controls in CenterCanvas (Zoom In/Out), LeftSidebar (cancel chain, edit, delete), and Toast (close).
    • Dark Mode: useDarkMode hook with Sun/Moon toggle, dark styles across components and index.css, preference stored in localStorage (flowforge_theme), and auto-sync with system setting when no saved choice.
  • Bug Fixes

    • Centralized theme state by replacing inline logic in App.tsx, unifying the storage key, and ensuring root dark class toggles correctly after resolving merge conflicts.

Written for commit 562ef4e. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features
    • Added a dark mode toggle with Sun/Moon icons.
    • Dark mode preference is remembered between visits and can follow system settings.
  • UI Improvements
    • Updated the canvas, sidebars, forms, controls, dialogs, and notifications for dark-mode visibility.
    • Added clearer accessibility labels to interactive controls.
    • Improved dark-mode styling for flowchart elements, zoom controls, and empty states.

Copilot AI review requested due to automatic review settings July 19, 2026 15:40
@vercel

vercel Bot commented Jul 19, 2026

Copy link
Copy Markdown

@rohitkumarnaidu is attempting to deploy a commit to the itzzavdhesh's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

✅ Thanks! This PR is linked to #54 and will close it automatically when merged.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds persisted dark-mode support with a toolbar toggle, applies dark styling across the canvas and sidebars, and improves accessibility labels for icon-only controls.

Changes

Dark mode and accessibility

Layer / File(s) Summary
Theme state and CSS foundation
src/utils/useDarkMode.ts, src/index.css
Initializes theme state from storage or system preference, persists changes, and defines the .dark Tailwind variant and body styles.
Application and canvas theme flow
src/App.tsx, src/components/CenterCanvas.tsx
Passes dark-mode state into the canvas, adds the Sun/Moon toggle, and updates canvas, node, toolbar, HUD, and modal styling.
Sidebar and notification styling
src/components/LeftSidebar.tsx, src/components/RightSidebar.tsx, src/components/Toast.tsx
Adds dark-mode variants across sidebar controls and toast actions, plus accessible labels and explicit edit/delete event handling.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • itzzavdhesh/FlowCraft#48: Overlaps with the dark-mode hook, canvas toggle, Tailwind variant, sidebar styling, and toast updates.
  • itzzavdhesh/FlowCraft#50: Contains corresponding dark-mode wiring and styling changes across the same application components.

Suggested labels: enhancement

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Dark mode hook, toggle, and styling changes are unrelated to issue #54's aria-label accessibility request. Move the dark-mode work to a separate PR or remove it so this PR only covers the aria-label accessibility fix.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description omits required template sections like Type of Change, Testing Performed, Screenshots, and the checklist. Add the missing template sections with testing details, change-type checkboxes, screenshots if relevant, and the full checklist.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR adds aria-labels to the icon-only buttons requested by issue #54, satisfying the linked accessibility objective.
Title check ✅ Passed The title matches a real part of the PR by calling out accessibility labels on buttons, though it omits the dark-mode changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/components/LeftSidebar.tsx (1)

1-1: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Conflicting and duplicate Tailwind dark-mode classes.

Several elements have multiple conflicting utility classes applied to the same CSS property (e.g., both dark:text-gray-300 and dark:text-gray-600). In Tailwind, the class generated last in the stylesheet will win, leading to unpredictable visual bugs and broken focus/hover states where state modifiers were accidentally omitted.

  • src/components/LeftSidebar.tsx#L172-172: Remove dark:text-gray-600 to resolve conflict with dark:text-gray-300.
  • src/components/LeftSidebar.tsx#L179-179: Replace dark:bg-gray-800/20 and dark:bg-gray-900 with appropriate state modifiers (e.g., dark:focus:bg-gray-900) to avoid overriding dark:bg-gray-800/50.
  • src/components/LeftSidebar.tsx#L186-186: Remove conflicting dark:text-gray-500 to leave dark:text-gray-400.
  • src/components/LeftSidebar.tsx#L193-193: Replace dark:bg-gray-900 with dark:focus:bg-gray-900 to prevent overriding the base dark background.
  • src/components/LeftSidebar.tsx#L197-197: Remove conflicting dark:text-gray-500 to leave dark:text-gray-400.
  • src/components/LeftSidebar.tsx#L204-204: Replace dark:bg-gray-900 with dark:focus:bg-gray-900 to prevent overriding the base dark background.
  • src/components/LeftSidebar.tsx#L239-239: Remove dark:bg-gray-800/50 which conflicts with the base dark:bg-gray-900.
  • src/components/RightSidebar.tsx#L37-37: Remove dark:text-gray-600 to resolve conflict with dark:text-gray-300.
  • src/components/RightSidebar.tsx#L106-106: Remove dark:text-gray-600 to resolve conflict with dark:text-gray-300.
  • src/components/RightSidebar.tsx#L112-112: Replace dark:bg-gray-800/20 and dark:bg-gray-900 with state modifiers (e.g., dark:focus:bg-gray-900) to avoid conflict with dark:bg-gray-800/50.
  • src/components/RightSidebar.tsx#L128-128: Remove dark:text-gray-600 to resolve conflict with dark:text-gray-300.
  • src/components/RightSidebar.tsx#L148-148: Remove dark:text-gray-600 to resolve conflict with dark:text-gray-300.
  • src/components/RightSidebar.tsx#L170-170: Remove dark:text-gray-600 to resolve conflict with dark:text-gray-300.
  • src/components/Toast.tsx#L68-69: Clean up duplicate dark:text-gray-400 and dark:text-gray-500 to leave a single intended base text color.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/LeftSidebar.tsx` at line 1, The sidebar and toast components
contain conflicting duplicate Tailwind dark-mode utilities. Update the affected
className strings in LeftSidebar, RightSidebar, and Toast by removing the
specified conflicting text/background classes, converting focus-only dark
backgrounds to dark:focus variants, and leaving each element with one intended
base dark color/background.
src/components/CenterCanvas.tsx (1)

440-447: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Apply dark styling to the canvas grid background.

The main canvas area has a hardcoded light background (bg-[#f8f9fa]) and light grid dots (#e2e8f0). Consequently, even when dark mode is toggled, the main drawing area remains bright, which visually breaks the dark mode integration.

Add a dark:bg-gray-900 class to the container and dynamically switch the dot color based on the isDarkMode state.

🎨 Proposed fix for the canvas background
-        className={`flex-grow relative overflow-hidden bg-[`#f8f9fa`] select-none ${
+        className={`flex-grow relative overflow-hidden bg-[`#f8f9fa`] dark:bg-gray-900 select-none ${
           isPanning ? 'cursor-grabbing' : 'cursor-grab'
         }`}
         style={{
-          backgroundImage: 'radial-gradient(`#e2e8f0` 1.5px, transparent 1.5px)',
+          backgroundImage: `radial-gradient(${isDarkMode ? '`#334155`' : '`#e2e8f0`'} 1.5px, transparent 1.5px)`,
           backgroundSize: `${20 * scale}px ${20 * scale}px`,
           backgroundPosition: `${pan.x}px ${pan.y}px`,
         }}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/CenterCanvas.tsx` around lines 440 - 447, Update the main
canvas container’s classes in CenterCanvas to include dark:bg-gray-900 alongside
the existing light background, and make its radial-gradient dot color depend on
isDarkMode so dark mode uses a darker grid color while light mode preserves
`#e2e8f0`. Keep the existing scale and pan positioning behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/CenterCanvas.tsx`:
- Line 365: Clean up the duplicated and conflicting Tailwind classes in
src/components/CenterCanvas.tsx at lines 365, 375, 395, 405, 414, 778, and 785:
align lines 365, 375, 405, and 414 with the Save button’s corrected class set;
remove redundant dark:border-gray-600, dark:text-gray-500, and
dark:hover:bg-gray-800 variants; fix the invalid :text-indigo-400 and
:bg-gray-800 tokens at line 395; remove dark:text-gray-500 at line 778; and
resolve conflicting border, text, and background classes at line 785 while
preserving the intended dark-mode styling.

In `@src/utils/useDarkMode.ts`:
- Around line 17-28: Update the useDarkMode synchronization effect to continue
applying or removing the dark class without writing to localStorage. Move
persistence into the explicit toggleDarkMode handler so localStorage is updated
only when the user toggles the theme, preserving the existing isDarkMode state
behavior.

---

Outside diff comments:
In `@src/components/CenterCanvas.tsx`:
- Around line 440-447: Update the main canvas container’s classes in
CenterCanvas to include dark:bg-gray-900 alongside the existing light
background, and make its radial-gradient dot color depend on isDarkMode so dark
mode uses a darker grid color while light mode preserves `#e2e8f0`. Keep the
existing scale and pan positioning behavior unchanged.

In `@src/components/LeftSidebar.tsx`:
- Line 1: The sidebar and toast components contain conflicting duplicate
Tailwind dark-mode utilities. Update the affected className strings in
LeftSidebar, RightSidebar, and Toast by removing the specified conflicting
text/background classes, converting focus-only dark backgrounds to dark:focus
variants, and leaving each element with one intended base dark color/background.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 57f483f4-a6af-4006-b934-ee95c699ba2f

📥 Commits

Reviewing files that changed from the base of the PR and between 22009dd and c365dda.

📒 Files selected for processing (7)
  • src/App.tsx
  • src/components/CenterCanvas.tsx
  • src/components/LeftSidebar.tsx
  • src/components/RightSidebar.tsx
  • src/components/Toast.tsx
  • src/index.css
  • src/utils/useDarkMode.ts

Comment thread src/components/CenterCanvas.tsx Outdated
Comment thread src/utils/useDarkMode.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 7 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/components/CenterCanvas.tsx Outdated
Comment thread src/components/LeftSidebar.tsx Outdated
Comment thread src/components/LeftSidebar.tsx Outdated
Comment thread src/components/RightSidebar.tsx Outdated
Comment thread src/utils/useDarkMode.ts
Comment thread src/components/LeftSidebar.tsx Outdated
Comment thread src/components/CenterCanvas.tsx Outdated
Comment thread src/utils/useDarkMode.ts Outdated
@rohitkumarnaidu

Copy link
Copy Markdown
Contributor Author

Hi! Could you please add the ELUSOC label to this PR so it gets tracked properly by the dashboard? Thanks!

@Itzzavdheshh

Copy link
Copy Markdown
Collaborator

@rohitkumarnaidu Please resolve the branch conflicts

@coderabbitai coderabbitai Bot mentioned this pull request Jul 29, 2026
@rohitkumarnaidu

Copy link
Copy Markdown
Contributor Author

Hi @itzzavdhesh! Just wanted to give a quick heads up on this PR. It looks like the only failing CI check is Vercel, which says 'Authorization required to deploy'. Could you please authorize the Vercel deployment so the checks can pass? Thank you! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Enhance Accessibility by adding aria-labels to icon buttons

3 participants