Show tooltip on click?

The tooltip example shows how to make a tooltip that is constantly active and a tooltip that is visible on hover. I was wondering if I can make a tooltip that is only shown on click (and hidden again when clicking outside of it)

Create a state field that tracks your tooltip status, a state effect that changes it, and a computed showTooltip facet that provides a tooltip when the state field holds an active tooltip.

And how do I react to clicks? can I use event listeners from the dom or do I need something else?

Use EditorView.domEventHandlers to register handlers on the editable element.