Skip to content

Add v8_attributionText future flag and explicit attribution HTML field - #474

Open
pjeweb wants to merge 1 commit into
mainfrom
feat/attribution-text-future-flag
Open

pjeweb wants to merge 1 commit into
mainfrom
feat/attribution-text-future-flag

Conversation

@pjeweb

@pjeweb pjeweb commented Nov 12, 2026

Copy link
Copy Markdown
Member

Summary

A layer's metaData.attribution is rendered as HTML by the chrome. Config has always been treated as trusted input, but for hosts that build layer metadata from text they do not control this is an injection path. In v8, attribution becomes plain text and markup needs an explicitly named field. This adds the opt-in path for 7.x; the default is unchanged.

  • New optional layer metadata field dangerouslySetAttributionHtml. The chrome always renders it as HTML, with or without the flag, so hosts can migrate first. It takes precedence when a layer sets both fields; an empty string counts as not set.
  • New future flag v8_attributionText (Decision 012). When enabled, metaData.attribution is rendered as a plain text node.
  • New core selector visibleLayerAttributionPartsSelector returning {text?, html?} per visible layer, for the chrome and for host interfaces that render attributions themselves. layerAttributionsSelector and visibleLayerAttributionsSelector are unchanged.
  • New config helper metaDataWithAttributionHtml(metaData, html).
  • AttributionEntries accepts the new parts and still accepts plain strings, which stay HTML (legends, existing direct callers).
  • Docs: the flag in Decision 012 and the config reference with a migration note, plus a new "HTML in config" section listing every config and feature field the chrome renders as HTML.

Out of scope: legends, feature details and the other HTML fields keep their behaviour.

Migration for hosts: move HTML attributions to dangerouslySetAttributionHtml, then enable v8_attributionText. Plain-text attributions need no change.

Test plan

  • pnpm --filter @mapsight/core test and pnpm --filter @mapsight/ui test
  • Component tests: default HTML rendering; with the flag an <img src=x onerror=…> string is rendered as text and no element is created; the HTML field in both modes; both fields set; empty HTML field; switching the flag on and removing the HTML field for an existing entry leave no markup behind; server-rendered markup is escaped; plain string entries and legends stay HTML
  • Selector, schema and helper tests; the existing attribution selectors return the same values as before
  • typecheck and lint for both packages (no errors), pnpm run check

@changeset-bot

changeset-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3a52826

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@mapsight/core Minor
@mapsight/ui Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Mapsight review links

Preview for 3a52826 · Open demos

Suggested starting points from the changed files and their demo consumers:

Screen PR preview Current main Suggested check
Custom overlays Open Compare Toggle individual layers and groups; check keyboard focus, visible map features and the feature list. Navigate the feature list with Tab and arrow keys, select an entry, and check pagination and map selection at a narrow viewport.
Keyboard point input Open Compare Tab to the map, pan with the arrow keys, press Enter or Space and check the stored value; then click the map and check the point is replaced.
Combined feature list Open Compare Toggle individual layers and groups; check keyboard focus, visible map features and the feature list. Navigate the feature list with Tab and arrow keys, select an entry, and check pagination and map selection at a narrow viewport.
Full UI Open Compare Toggle individual layers and groups; check keyboard focus, visible map features and the feature list. Navigate the feature list with Tab and arrow keys, select an entry, and check pagination and map selection at a narrow viewport.
Router integration Open Compare Toggle individual layers and groups; check keyboard focus, visible map features and the feature list. Navigate the feature list with Tab and arrow keys, select an entry, and check pagination and map selection at a narrow viewport.
Why these screens?

These are suggested checks, not a verified reproduction of the issue. Current main can move independently of this PR; new behavior may need the PR author's setup steps.

Updated after successful deployments. The commit above identifies this preview; a newer build may still be running.

This branch was successfully deployed

1 active deployment
preview/pr-474 — 3a52826c Deployed Nov 12, 2026 by github-actions[bot]
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.

1 participant