This event is emitted whenever an annotation is focused. Selecting an annotation also focuses it.
When an annotation is deselected by pressing the Escape key, successive annotations.blur
and annotations.focus events will be dispatched for the same annotation.
Use this event to add custom behavior like announcing the annotation value to screen readers.
Example
Log text annotation value
instance.addEventListener("annotations.focus", (event) => { if (event.annotationinstanceofAnnotations.TextAnnotation) { console.log(event.annotation.text); } });
This event is emitted whenever an annotation is focused. Selecting an annotation also focuses it.
When an annotation is deselected by pressing the
Escapekey, successiveannotations.blurandannotations.focusevents will be dispatched for the same annotation.Use this event to add custom behavior like announcing the annotation value to screen readers.
Example
Log text annotation value