Skip to main content

Attribution

The map credits for the bottom-end slot: a compact "Map credits" button (a 44 px target around a small info glyph) that expands into a labelled region of credit links built with buildAttribution.

This is a function exported by @mapcairn/map, checked against version 0.2.0.

Signature​

import { Attribution } from "@mapcairn/map";

function Attribution(input: AttributionProps): JSX.Element;

Parameters​

  • { basemap, layerCredits, introHeld: hostHold, aboutLink, }
  • input (AttributionProps)

Returns​

JSX.Element

Remarks​

The credits are shown by themselves once, when the map has started, because the OpenStreetMap attribution guidelines allow them to be collapsed only after they have been seen. That first showing moves no focus and is a plain region, not a dialog or live region, so nothing is announced. It collapses on the first map interaction (a zoom the person makes, the map moving, a press outside it) or after ATTRIBUTION_INTRO_MS, whichever comes first, fading out unless reduced motion is on. Focus moving into it during that time keeps it open as if the person had opened it. A host with another card on the map (its first-visit tour) holds the first showing back with introHeld, and it starts, for the full time, when the hold ends.

After that it behaves as a popover the person opens. It opens above the bottom row, clear of the readout beside the button; where it starts a gap after the readout's end edge, so the two share no width, it sits next to the button instead of rising over the readout's height, and it is measured again when the readout resizes or slides sideways. If the credits would scroll there, it moves beside the end stack before it is painted, where MapChrome measures more room; it scrolls only if that is not enough either. Opening moves focus to the first link. The popover closes on Escape, on a second press of the button, on a pointer down outside it, and when the map moves; if focus was inside it, focus goes back to the button with an explicit focus() (Safari does not focus buttons on click). The credits are always reachable through the button; nothing here hides or removes them. Reads the map with useMap(), so it must sit inside the map context.

See also​

Source: packages/map/src/chrome/Attribution/Attribution.tsx:225