syncfusion/blazor-ui-components-skills / skills/syncfusion-blazor-maps
syncfusion-blazor-maps
VerifiedImplement interactive spatial data visualization with Syncfusion Maps component for Blazor. Use this skill when user needs to display geographic data, add markers/polygons to maps, integrate map providers (Google Maps, Bing Maps, Azure Maps, OpenStreetMap), create choropleth visualizations, handle user interactions with maps, export/print maps, support internationalization, implement accessibility features, or customize map styling and appearance.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 23.0 KB |
| references/accessibility.md | markdown | 9.9 KB |
| references/api-reference.md | markdown | 32.1 KB |
| references/customization-and-styling.md | markdown | 18.6 KB |
| references/data-visualization.md | markdown | 23.4 KB |
| references/events-and-methods.md | markdown | 28.1 KB |
| references/getting-started.md | markdown | 10.9 KB |
| references/internationalization-and-localization.md | markdown | 10.8 KB |
| references/map-providers.md | markdown | 16.8 KB |
| references/markers-and-layers.md | markdown | 27.3 KB |
| references/print-and-export.md | markdown | 13.0 KB |
| references/readme-security.md | markdown | 7.0 KB |
| references/security-review.md | markdown | 17.8 KB |
| references/spatial-features.md | markdown | 23.4 KB |
| references/state-persistence.md | markdown | 5.5 KB |
| references/user-interactions.md | markdown | 15.1 KB |
references/accessibility.md
View on GitHub> **MANDATORY SECURITY NOTICE:** Do NOT load GeoJSON, ShapeData, tile, or image resources directly from untrusted third‑party URLs at runtime. Host assets locally or return server-validated, signed URLs; validate GeoJSON/ShapeData against a strict schema, sanitize/HTML-encode properties, enforce size/complexity limits, and require human review before automated processing or forwarding to agents.
## Table of Contents
- [WCAG 2.1 Compliance](#wcag-21-compliance)
- [Semantic HTML Structure](#semantic-html-structure)
- [Color Contrast Requirements](#color-contrast-requirements)
- [Keyboard Navigation and Shortcuts](#keyboard-navigation-and-shortcuts)
- [Enable Keyboard Navigation](#enable-keyboard-navigation)
- [Skip Links](#skip-links)
- [ARIA Attributes and Labels](#aria-attributes-and-labels)
- [Comprehensive ARIA Implementation](#comprehensive-aria-implementation)
- [Screen Reader Support](#screen-reader-support)
- [Text Alternatives for Visual Elements](#text-alternatives-for-visual-elements)
- [Descriptive Tooltips](#descriptive-tooltips)
- [High Contrast Mode Support](#high-contrast-mode-support)
- [Detect and Apply High Contrast](#detect-and-apply-high-contrast)
- [Focus Management](#focus-management)
- [Focus Indicators](#focus-indicators)
- [Focus Trap for Modal-Like Behavior](#focus-trap-for-modal-like-behavior)
- [Testing for Accessibility](#testing-for-accessibility)
- [Accessibility Audit Checklist](#accessibility-audit-checklist)
- [Browser DevTools Accessibility Audit](#browser-devtools-accessibility-audit)
# Accessibility and Advanced Topics
> **W011 Security Note:** Accessibility examples in this topic load external map data and tiles. If the content is sourced from third parties, validate it before rendering and sanitize any text that could appear in tooltips or annotations.
## WCAG 2.1 Compliance
### Semantic HTML Structure
Ensure map container has proper semantic markup:
```csharp
@page "/accessible-map"
@using Syncfusion.Blazor.Maps
<main>
<section role="region" aria-label="Interactive map of population density">
<h1>Population Density Map</h1>
<p>This interactive map displays population density by region.</p>
<div role="region" aria-live="polite" aria-label="Map container">
<SfMaps @ref="mapInstance">
<MapsLayers>
<MapsLayer ShapeData='new {dataOptions = "/data/world-map.json"}' TValue="string">
</MapsLayer>
</MapsLayers>
</SfMaps>
</div>
</section>
</main>
@code {
private SfMaps mapInstance;
}
```
### Color Contrast Requirements
Ensure sufficient contrast for all map elements:
```csharp
<style>
/* WCAG AA: Minimum 4.5:1 contrast for normal text */
.e-maps {
color: #000000; /* High contrast */
background: #FFFFFF;
}
/* WCAG AAA: Minimum 7:1 contrast */
.e-tooltip {
color: #000000; /* Very high contrast */
background: #FFFF00;
}
/* Ensure legend is readable */
.e-legend {
color: #1A1A1A; /* Dark text */
background: #FFFFFF;
}
/* Shape colors must have sufficient contrast */
.e-shape {
fill: #0066CC; /* Accessible blue */
stroke: #000000; /* High contrast border */
}
.e-shape.high-value {
fill: #DD0000; /* WCAG AA compliant red */
}
</style>
```
Use contrast checkers:
- WebAIM Contrast Checker
- WCAG Color Contrast Checker
- Chrome DevTools Accessibility audit
## Keyboard Navigation and Shortcuts
### Enable Keyboard Navigation
```csharp
@page "/keyboard-accessible"
@using Syncfusion.Blazor.Maps
<div role="region" aria-label="Map keyboard navigation controls">
<h2>Keyboard Navigation Help</h2>
<ul>
<li><kbd>Tab</kbd> - Focus map controls</li>
<li><kbd>+</kbd> - Zoom in</li>
<li><kbd>-</kbd> - Zoom out</li>
<li><kbd>Arrow Keys</kbd> - Pan map</li>
<li><kbd>Home</kbd> - Reset to default view</li>
<li><kbd>Enter</kbd> - Activate focused element</li>
</ul>
</div>
<SfMaps>
<MapsZoomSettings Enable="true" ZoomFactor="2"></MapsZoomSettings>
<MapsLayers>
<!-- Use a validated TileUrl variable; prefer local/cached tiles for production -->
<MapsLayer UrlTemplate="@TileUrl" TValue="string">
</MapsLayer>
</MapsLayers>
</SfMaps>
```
### Skip Links
Allow users to skip to map content:
```html
<!-- Place at top of page -->
<a href="#map-content" class="skip-link">Skip to map content</a>
<style>
/* Hide skip link but visible on focus */
.skip-link {
position: absolute;
left: -9999px;
z-index: 999;
}
.skip-link:focus {
position: fixed;
top: 0;
left: 0;
background: #000;
color: #FFF;
padding: 8px;
z-index: 999;
}
</style>
```
## ARIA Attributes and Labels
### Comprehensive ARIA Implementation
```csharp
@page "/aria-map"
@using Syncfusion.Blazor.Maps
<div role="region" aria-labelledby="map-title" aria-describedby="map-description">
<h1 id="map-title">Global Temperature Map</h1>
<p id="map-description">
Interactive choropleth map showing average temperature by region.
Use keyboard arrows to pan, +/- to zoom. Click regions for details.
</p>
<SfMaps @ref="mapInstance">
<MapsZoomSettings Enable="true" ZoomFactor="4"></MapsZoomSettings>
<MapsLayers>
<MapsLayer ShapeData='new {dataOptions = "/data/world-map.json"}' TValue="TemperatureRegion" DataSource="@TemperatureData">
<MapsShapeSettings ColorValuePath="Temperature">
<MapsShapeColorMappings>
<MapsShapeColorMapping StartRange="-20" EndRange="0" Color='new string[] { "#4575B4" }' />
<MapsShapeColorMapping StartRange="0" EndRange="15" Color='new string[] { "#91BFDB" }' />
<MapsShapeColorMapping StartRange="15" EndRange="25" Color='new string[] { "#FEE090" }' />
<MapsShapeColorMapping StartRange="25" EndRange="40" Color='new string[] { "#F46D43" }' />
</MapsShapeColorMappings>
</MapsShapeSettings>
<MapsDataLabelSettings Visible="true" LabelPath="RegionName">
</MapsDataLabelSettings>
</MapsLayer>
</MapsLayers>
<MapsLegendSettings Visible="true" />
</SfMaps>
</div>
@code {
private SfMaps mapInstance;
private List<TemperatureRegion> TemperatureData = new();
public class TemperatureRegion
{
public string RegionName { get; set; }
public double Temperature { get; set; }
}
}
```
## Screen Reader Support
### Text Alternatives for Visual Elements
```csharp
@page "/screen-reader-friendly"
@using Syncfusion.Blazor.Maps
<!-- Alternative text representation -->
<details>
<summary>Text description of map (for screen readers)</summary>
<table>
<thead>
<tr>
<th>Region</th>
<th>Population</th>
<th>Density</th>
</tr>
</thead>
<tbody>
@foreach (var region in RegionData)
{
<tr>
<td>@region.Name</td>
<td>@region.Population.ToString("N0")</td>
<td>@region.Density.ToString("F1") per km</td>
</tr>
}
</tbody>
</table>
</details>
<SfMaps @ref="mapInstance">
<MapsZoomSettings ZoomFactor="1"></MapsZoomSettings>
<MapsLayers>
<MapsLayer ShapeData='new {dataOptions= "/data/usa-map.json"}' TValue="RegionInfo" DataSource="@RegionData">
<MapsDataLabelSettings Visible="true" LabelPath="name">
</MapsDataLabelSettings>
</MapsLayer>
</MapsLayers>
</SfMaps>
@code {
private SfMaps mapInstance;
// Use a validated tile URL in production; prefer bundling tiles locally
private string TileUrl = "/tiles/{level}/{tileX}/{tileY}.png";
}
private List<RegionInfo> RegionData = new()
{
new RegionInfo { Name = "Texas", Population = 5000000, Density = 120 },
new RegionInfo { Name = "Region B", Population = 3000000, Density = 85 }
};
public class RegionInfo
{
public string Name { get; set; }
public int Population { get; set; }
public double Density { get; set; }
}
}
```
### Descriptive Tooltips
```csharp
<MapsMarker Visible="true" Shape="Syncfusion.Blazor.Maps.MarkerType.Circle" Fill="white" Width="20"
DataSource="HighestPopulation" TValue="City">
<MapsMarkerBorder Width="2" Color="#333"></MapsMarkerBorder>
<MapsMarkerTooltipSettings Visible="true" ValuePath="Name"></MapsMarkerTooltipSettings>
</MapsMarker>
</MapsMarkerSettings>
```
## Testing for Accessibility
### Accessibility Audit Checklist
- [ ] **Keyboard Navigation:** All interactive elements accessible via Tab/Shift+Tab
- [ ] **Focus Indicators:** Clear visual focus indicator on all elements
- [ ] **Color Contrast:** All text meets WCAG AA (4.5:1) minimum
- [ ] **ARIA Labels:** All regions and interactive elements properly labeled
- [ ] **Alt Text:** Meaningful descriptions for all visual content
- [ ] **Heading Structure:** Proper heading hierarchy (h1 > h2 > h3)
- [ ] **Link Text:** Links have descriptive text (avoid "click here")
- [ ] **Form Labels:** All inputs associated with labels
- [ ] **Error Messages:** Clear, helpful error descriptions
- [ ] **Skip Links:** Users can skip repetitive content
- [ ] **Zoom:** Page works at 200% zoom
- [ ] **Motion:** No content that flashes more than 3 times/second
- [ ] **Screen Reader:** Tested with NVDA, JAWS, or VoiceOver
### Browser DevTools Accessibility Audit
```javascript
// Run in browser console
// Chrome: Lighthouse, Edge: DevTools Accessibility
// Firefox: WAVE extension
// All browsers: axe DevTools extension
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |