Skip to content

[WIP] Create ImageMap component in Blazor#337

Merged
csharpfritz merged 6 commits intodevfrom
copilot/create-imagemap-component
Feb 10, 2026
Merged

[WIP] Create ImageMap component in Blazor#337
csharpfritz merged 6 commits intodevfrom
copilot/create-imagemap-component

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

✅ Implementation Complete: ImageMap Component

Summary

Successfully implemented the ImageMap component that enables interactive images with clickable regions (hot spots) that can navigate to URLs or trigger server-side events. This component helps developers migrate ASP.NET Web Forms ImageMap controls to Blazor with minimal code changes.

Component Implementation ✅

  • Created HotSpotMode enum (Navigate, PostBack, Inactive, NotSet)
  • Created base HotSpot class with shared properties
  • Created three HotSpot types: RectangleHotSpot, CircleHotSpot, PolygonHotSpot
  • Created ImageMapEventArgs for Click events
  • Implemented ImageMap component with proper HTML rendering
  • Renders standard HTML img with usemap + map with area elements
  • Used thread-safe counter for unique map IDs
  • Proper async Task event handlers
  • Correct mode inheritance logic (HotSpots inherit ImageMap mode when not explicitly set)

Testing ✅

  • Created comprehensive test suite with 23 tests
  • Tests cover all HotSpot types (Rectangle, Circle, Polygon)
  • Tests cover all modes (Navigate, PostBack, Inactive)
  • Tests cover mixed scenarios and component properties
  • All 23 ImageMap tests passing
  • All 655 solution tests passing (no regressions)

Documentation ✅

  • Created detailed ImageMap.md documentation
  • Includes Web Forms vs Blazor syntax comparisons
  • Includes practical examples for common scenarios
  • Updated mkdocs.yml navigation
  • Updated README.md with documentation link
  • Updated status.md: 18/27 Editor Controls complete (67%), 39/53 total (74%)

Code Quality ✅

  • Addressed all code review feedback
  • No compilation errors or warnings introduced
  • Follows project conventions and patterns
  • Comprehensive XML documentation
  • Clean, maintainable code

Ready for Merge

This PR is complete and ready for final review and merge.

Original prompt

This section details on the original issue you should resolve

<issue_title>Create the ImageMap component</issue_title>
<issue_description>We need to create the ImageMap component in Blazor to mimic the original Web Forms control</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 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 February 9, 2026 17:31
Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
…rom event handler, fix mode inheritance logic

Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
- Change base class from BaseWebFormsComponent to BaseStyledComponent for CssClass/Style support
- Replace static _mapIdCounter with Guid-based instance ID to avoid cross-test leaks
- Add Enabled property propagation to area elements (disabled renders nohref)
- Add class and style attributes to img element
- ImageAlign rendering via .ToString().ToLower() already matches Web Forms output
@csharpfritz csharpfritz marked this pull request as ready for review February 10, 2026 16:40
@csharpfritz csharpfritz merged commit 2c867c2 into dev Feb 10, 2026
4 checks passed
@csharpfritz csharpfritz deleted the copilot/create-imagemap-component branch February 10, 2026 16:40
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.

Create the ImageMap component

2 participants