Skip to main content
Urbicon UI
source

PushPermissionPrompt

A dismissible prompt that asks the user to enable push notifications, then registers the VAPID subscription with your server.

01 Usage

Basic

Enable push notifications?

<script lang="ts">
  import { PushPermissionPrompt } from '@urbicon-ui/auth';
</script>

<PushPermissionPrompt vapidPublicKey="BExample...base64-encoded-vapid-public-key" />

02 Accessibility

It never interrupts

The prompt is an ordinary card in the flow, not a modal: it keeps focus where it was on mount, and both actions are buttons, so a user can read it, act on it, or ignore it when they reach it.

Failures are announced, dismissals are not

The role="alert" region inside the card is always mounted while the prompt is visible, so a rejected VAPID key, a conflicting endpoint or a rate limit is announced in place and the prompt stays open to retry. A denied browser permission is not an error and closes the prompt instead.

Focus is handed on when the card closes

Enabling or dismissing unmounts the whole card, so the button that was pressed goes with it and the next Tab would otherwise start over at the top of the page. The prompt moves focus to the element that held it when the prompt appeared; if that element is gone, to the next tab stop after the card; failing that, to the one before it. Controls that are disabled or not rendered are skipped, and nothing outside the card is modified on the way — no page heading is made focusable to catch the ring. A page whose only controls were inside the card keeps none, so focus lands where the browser puts it.

Your callback runs first. onDismissed, onSubscribed and onUnavailable are called before the prompt looks for a landing spot, and it only moves focus that is still on its own two buttons — so a callback that places focus itself wins, and so does a user who clicked elsewhere while the request ran.

03 API Reference

12 props 1 required
Prop
Type
Default
Description

04 Types

Local type definitions used by this component.

5 types
Name
Kind
Category
Used by
Description

05 Installation

Import

import { PushPermissionPrompt } from '@urbicon-ui/auth';