Skip to main content

StatusMessage

A toast or banner: an icon, text and a dismiss button, so the variant is never conveyed by colour alone. It is the one visible live region besides the hidden announcer: role="status" for info and success, role="alert" for errors. The role sits on the text only, so a screen reader never reads the Retry and Dismiss buttons as part of the message.

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

Signature​

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

function StatusMessage(input: StatusMessageProps): JSX.Element;

Description​

When the message goes away while focus is inside it (Dismiss, or an action that ends the condition), focus returns to the element it came from, or to the stop a StatusMessageFocusProvider supplies (MapView supplies its map region) when that element is gone, cannot take focus or focus came from the page, so a keyboard person keeps their place. Without a provider focus is left where it is. Focus is left alone if it was elsewhere.

Errors stay until dismissed. Other messages dismiss themselves after the delay, and the countdown pauses while the pointer is over the message or focus is inside it, then resumes with the time left.

Parameters​

  • { variant, children, onDismiss, action, autoDismissMs, dismissLabel, className, ...rest }
  • input (StatusMessageProps)

Returns​

JSX.Element

See also​

Source: packages/map/src/ui/StatusMessage/StatusMessage.tsx:81