Skip to content

Accessibility

Glare mounts a role="dialog" container with aria-modal="true". Slide changes are announced through a polite live region, and toolbar toggles expose their state through their labels (aria-expanded for thumbnails).

Focus

OptionDefaultWhat it does
autoFocustrueMove focus into the dialog on open.
trapFocustrueKeep Tab inside the dialog.
backFocustrueReturn focus to the trigger on close.

Controls hidden by the idle fade leave the tab order until the next key press, pointer move, click, or touch.

Keyboard

KeyAction
EscClose. Closes the share overlay first when it is open; also collapses the More options menu.
/ Previous slide.
/ Next slide.
SpaceToggle slideshow.
FToggle fullscreen.

Disable shortcuts with keyboard: false, or use modal: true, which also ignores backdrop clicks and turns off idle fade.

Labels

Every built-in string comes from the i18n dictionary. Provide translations under i18n and pick them with lang. Missing keys fall back to English. The full English key list:

KeyEnglish default
CLOSEClose
NEXTNext
PREVPrevious
ERRORThe requested content cannot be loaded…
LOADINGLoading
LIGHTBOXMedia lightbox
GO_TO_SLIDEGo to slide
VIDEO_UNSUPPORTEDYour browser does not support HTML5 video.
PLAY_STARTStart slideshow
PLAY_STOPPause slideshow
FULL_SCREENFull screen
FULL_SCREEN_EXITExit full screen
THUMBSThumbnails
DOWNLOADDownload
SHAREShare
MOREMore options
COPYCopy link
ZOOMZoom
ZOOM_OUTZoom out
js
Glare.bind('[data-glare]', {
  lang: 'es',
  i18n: {
    es: {
      CLOSE: 'Cerrar',
      NEXT: 'Siguiente',
      PREV: 'Anterior',
      ERROR: 'No se pudo cargar el contenido.',
      LOADING: 'Cargando',
      LIGHTBOX: 'Visor multimedia',
      GO_TO_SLIDE: 'Ir a la diapositiva {{index}}',
      VIDEO_UNSUPPORTED: 'Tu navegador no admite vídeo HTML5.',
      PLAY_START: 'Iniciar presentación',
      PLAY_STOP: 'Pausar',
      FULL_SCREEN: 'Pantalla completa',
      FULL_SCREEN_EXIT: 'Salir de pantalla completa',
      THUMBS: 'Miniaturas',
      DOWNLOAD: 'Descargar',
      SHARE: 'Compartir',
      MORE: 'Más opciones',
      COPY: 'Copiar enlace',
      ZOOM: 'Zoom',
      ZOOM_OUT: 'Alejar',
    },
  },
})

Reduced motion

When prefers-reduced-motion: reduce is set, open and transition animations collapse to instant changes.

Released under the MIT License.