Skip to content

Conversation

Copy link

Copilot AI commented Dec 16, 2025

Addresses code review feedback from PR #9's dynamic tile creation feature. The original implementation had accessibility gaps, visibility issues on dark backgrounds, and suboptimal rendering performance.

Changes

Accessibility

  • Added aria-label attributes to tile control buttons and dropdown for screen reader support

Visual Contrast

  • Changed button text color from #2d2d2d to #f1f1f1 for visibility against dark title bar background

User Experience

  • Implemented click-outside handler to dismiss dropdown when focus leaves the control area
  • Display human-readable tile names in dropdown ("Map View" vs "mapView")

Performance & Code Quality

  • Moved Controls component outside render scope and memoized to prevent recreation
  • Extracted PendingAdd type for reuse and clarity
  • Removed unnecessary useMemo wrapper around static ALL_TILES array
  • Added null validation in dropdown onChange handler
// Before: camelCase identifiers, recreated on every render
const Controls: React.FC<{...}> = ({ id, path }) => {
  // Component defined inside parent render
  return <select>
    <option>{t}</option> {/* "mapView" */}
  </select>
}

// After: memoized component with readable labels
const Controls = memo<{...}>(({ id, path, pendingAdd, setPendingAdd }) => {
  return <select aria-label="Select tile to add">
    <option>{TILE_DISPLAY_NAMES[t]}</option> {/* "Map View" */}
  </select>
});

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits December 16, 2025 19:40
…rformance

- Added TILE_DISPLAY_NAMES mapping for human-readable tile names (e.g., 'Map View' instead of 'mapView')
- Added aria-label attributes to add tile buttons and select dropdown for screen reader accessibility
- Fixed button text color from #2d2d2d to #f1f1f1 for better visibility on dark background
- Moved Controls component outside render function and memoized it to prevent unnecessary re-renders
- Removed unnecessary useMemo from ALL_TILES constant (now a static const)
- Added null check validation in onChange handler before calling splitAndAdd
- Implemented click-outside handler to close dropdown when user clicks elsewhere

Co-authored-by: ConnorNeed <129120300+ConnorNeed@users.noreply.github.com>
- Extracted PendingAdd type for better maintainability and reusability
- Updated comment to more accurately describe validation logic

Co-authored-by: ConnorNeed <129120300+ConnorNeed@users.noreply.github.com>
- Wrapped setPendingAdd with useMemo to preserve Controls component memoization benefits
- Updated all renderTile cases to use the memoized handleSetPendingAdd

Co-authored-by: ConnorNeed <129120300+ConnorNeed@users.noreply.github.com>
- setState functions from useState are already stable and don't need memoization
- Removed ineffective useMemo wrapper and pass setPendingAdd directly to Controls

Co-authored-by: ConnorNeed <129120300+ConnorNeed@users.noreply.github.com>
Copy link
Author

Copilot AI commented Dec 16, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/webUI/webUI/node_modules/next/dist/compiled/jest-worker/processChild.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add dynamic tile creation to webUI Address accessibility, visibility, and performance issues in dynamic tile controls Dec 16, 2025
Copilot AI requested a review from ConnorNeed December 16, 2025 19:48
@ConnorNeed ConnorNeed marked this pull request as ready for review December 16, 2025 20:02
@ConnorNeed ConnorNeed merged commit 5be2ce2 into more-custom Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants