---
title: "Performance, CSP & Accessibility · Nuxt Scripts"
description: "ScriptMapLibreMap loads near the viewport by default and reserves its configured dimensions during SSR. The SDK, stylesheet, Web Worker, style, and tiles stay off the network until the trigger runs."
canonical_url: "https://scripts.nuxt.com/scripts/maplibre/guides/performance-csp-and-accessibility"
meta:
  "og:description": "ScriptMapLibreMap loads near the viewport by default and reserves its configured dimensions during SSR. The SDK, stylesheet, Web Worker, style, and tiles stay off the network until the trigger runs."
  "og:image": "https://scripts.nuxt.com/_og/s/o_ac8b241c2bd0d5ce.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Performance, CSP & Accessibility · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/s/o_ac8b241c2bd0d5ce.png"
---

> Index of every page on this site: [llms.txt](https://scripts.nuxt.com/llms.txt)

**Guides**

# **Performance, CSP & Accessibility**

[Copy for LLMs](https://scripts.nuxt.com/scripts/maplibre/guides/performance-csp-and-accessibility.md)

`**ScriptMapLibreMap**` loads near the viewport by default and reserves its configured dimensions during SSR. The SDK, stylesheet, Web Worker, style, and tiles stay off the network until the trigger runs.

## Loading Strategies

Use the default `**visible**` trigger for maps below the fold:

```vue
<ScriptMapLibreMap
  :center="[144.9631, -37.8136]"
  map-style="https://tiles.openfreemap.org/styles/liberty"
/>
```

Load immediately when the map is the page's primary content:

```vue
<ScriptMapLibreMap
  trigger="immediate"
  :center="[144.9631, -37.8136]"
  map-style="https://tiles.openfreemap.org/styles/liberty"
/>
```

Always provide a height so SSR and the first client render use the same layout:

```vue
<ScriptMapLibreMap
  width="100%"
  height="clamp(24rem, 60vw, 36rem)"
  :center="[144.9631, -37.8136]"
  map-style="https://tiles.openfreemap.org/styles/liberty"
/>
```

## WebGL and Loading Failures

MapLibre needs WebGL and several resources referenced by the style. Use the `**error**` slot for browsers without WebGL and for network or initialization failures:

```vue
<ScriptMapLibreMap
  :center="[144.9631, -37.8136]"
  map-style="https://tiles.openfreemap.org/styles/liberty"
>
  <template #error>
    <p role="alert">
      The route map is unavailable. Follow the delivery status list instead.
    </p>
  </template>
</ScriptMapLibreMap>
```

Keep essential locations, route status, and actions in normal HTML rather than relying on the canvas.

## Accessibility

Give each interactive map a useful `**aria-label**`. Use the `**description**` slot for the locations, routes, or links a screen-reader user needs, and give each marker a unique `**aria-label**`.

```vue
<ScriptMapLibreMap
  aria-label="Delivery route from the depot to Flinders Lane"
  :center="[144.9538, -37.8151]"
  map-style="https://tiles.openfreemap.org/styles/liberty"
>
  <template #description>
    The courier is at Docklands and is heading to Flinders Lane.
  </template>
</ScriptMapLibreMap>
```

The component's container is the only landmark. MapLibre marks its canvas as a second `**region**`, so the component removes that role.

MapLibre's keyboard handler pans, zooms and rotates the map while the canvas has focus. The canvas stays in the tab order only while that handler runs. If keyboard control adds nothing for your users, disable it. The canvas then leaves the tab order and the accessibility tree:

```vue
<ScriptMapLibreMap
  aria-label="Depot locations"
  :options="{ keyboard: false }"
  :center="[144.9631, -37.8136]"
  map-style="https://tiles.openfreemap.org/styles/liberty"
/>
```

The component reads the handler state when it creates the map. If you call `**map.keyboard.disable()**` later, update the canvas attributes yourself.

For a decorative map, set `**:interactive="false"**`. The component disables input, removes the map from the accessibility tree, and makes its descendants inert.

## Stylesheet Loading

Nuxt Scripts loads the stylesheet from the `**maplibre-gl**` package when the SDK starts loading. To control the stylesheet through Nuxt instead:

nuxt.config.ts

```ts
export default defineNuxtConfig({
  css: ['maplibre-gl/dist/maplibre-gl.css'],
})
```

```vue
<ScriptMapLibreMap
  :center="[144.9631, -37.8136]"
  :inject-styles="false"
  map-style="/maps/style.json"
/>
```

## Content Security Policy

MapLibre v6 loads its worker from a real URL served by your own build, so `**worker-src blob:**` is no longer required. The map still needs `**img-src data: blob:**` alongside the origins used by your style.

To serve the worker from a different path, set `**worker-url**`:

```vue
<ScriptMapLibreMap
  :center="[144.9631, -37.8136]"
  map-style="/maps/style.json"
  worker-url="/maplibre-gl-worker.mjs"
/>
```

Add the style, tile, sprite, glyph, and worker origins to the matching directives in your policy. See MapLibre's [**CSP directives**](https://maplibre.org/maplibre-gl-js/docs/#csp-directives) for the complete requirements.

[Edit this page](https://github.com/nuxt/scripts/edit/main/docs/content/maplibre/1.guides/3.performance-csp-and-accessibility.md)

[Markdown For LLMs](https://scripts.nuxt.com/scripts/maplibre/guides/performance-csp-and-accessibility.md)

[**Styles & Providers** MapLibre GL JS renders the map in the browser. It does not include a basemap or a hosted tile service.](https://scripts.nuxt.com/scripts/maplibre/guides/styles-and-providers) [**Raw Map Instance** Call the MapLibre Map directly for layer events, filtering, hover state, and camera animation.](https://scripts.nuxt.com/scripts/maplibre/guides/raw-map-instance)

**On this page **

- [Loading Strategies](#loading-strategies)
- [WebGL and Loading Failures](#webgl-and-loading-failures)
- [Accessibility](#accessibility)
- [Stylesheet Loading](#stylesheet-loading)
- [Content Security Policy](#content-security-policy)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scripts.nuxt.com/#website","@type":"WebSite","description":"Nuxt Scripts lets you load third-party scripts with better performance, privacy, security and DX. It includes many popular third-parties out of the box.","name":"Nuxt Scripts","url":"https://scripts.nuxt.com/","publisher":{"@id":"https://scripts.nuxt.com/#identity"}},{"@id":"https://scripts.nuxt.com/scripts/maplibre/guides/performance-csp-and-accessibility#webpage","@type":"WebPage","description":"ScriptMapLibreMap loads near the viewport by default and reserves its configured dimensions during SSR. The SDK, stylesheet, Web Worker, style, and tiles stay off the network until the trigger runs.","name":"Performance, CSP & Accessibility","url":"https://scripts.nuxt.com/scripts/maplibre/guides/performance-csp-and-accessibility","breadcrumb":{"@id":"https://scripts.nuxt.com/scripts/maplibre/guides/performance-csp-and-accessibility#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/scripts/maplibre/guides/performance-csp-and-accessibility"]}],"primaryImageOfPage":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/#identity","@type":"Organization","name":"Nuxt Scripts","url":"https://scripts.nuxt.com","logo":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/scripts/maplibre/guides/performance-csp-and-accessibility#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Nuxt Scripts","item":"https://scripts.nuxt.com/","position":1},{"@type":"ListItem","name":"Scripts","item":"https://scripts.nuxt.com/scripts","position":2},{"@type":"ListItem","name":"Maplibre","item":"https://scripts.nuxt.com/scripts/maplibre","position":3},{"@type":"ListItem","name":"Guides","item":"https://scripts.nuxt.com/scripts/maplibre/guides","position":4},{"@type":"ListItem","name":"Performance, CSP & Accessibility","item":"https://scripts.nuxt.com/scripts/maplibre/guides/performance-csp-and-accessibility","position":5}]},{"@id":"https://scripts.nuxt.com/#logo","@type":"ImageObject","caption":"Nuxt Scripts","contentUrl":"https://scripts.nuxt.com/logo.svg","inLanguage":"en","url":"https://scripts.nuxt.com/logo.svg"}]}
```

## Sitemap

See the full [sitemap](https://scripts.nuxt.com/sitemap.md) for all pages.
