Custom React component
A custom component would:
- Handle text selection natively in the browser (no clientside callbacks needed at all)
- Render highlights as DOM manipulation rather than Dash component trees
- Handle add/delete/hover interactions with zero round-trips
- Only communicate with Python when the annotation data needs to be persisted — a single write to annotations-store on each change
The tradeoff is implementation cost. It's a meaningful project — you'd need the React component, a Dash component wrapper built with dash-component-boilerplate, and integration with the existing span data model. But it would completely solve the span latency problem and likely produce a better UX (native text selection behavior, no flicker on highlight, smoother hover/delete interactions).
Custom React component
A custom component would:
The tradeoff is implementation cost. It's a meaningful project — you'd need the React component, a Dash component wrapper built with dash-component-boilerplate, and integration with the existing span data model. But it would completely solve the span latency problem and likely produce a better UX (native text selection behavior, no flicker on highlight, smoother hover/delete interactions).