kevin91nl/text-highlighter

Bug - input text disappears when a label is highlighted

Closed this issue · 1 comments

Environment

  • OS: Ubuntu 22.04 LTS
  • Python: new virtualenv with python 3.10
  • streamlit version: 1.17.0
  • text-highlighter version: 0.0.7

Description

When at least one word of the text has already been labelled, selecting the label makes the input text disappear. It becomes also possible to add labels to other labels, which results in a set of NULL values in the output.
Here is a short video about the issue.

How to reproduce the issue

  1. Run the example.py file as streamlit app
  2. Highlight a word
  3. Highlight the label: hold the left mouse button and drag to move the cursor, do not double-click. The issue cannot be observed with a double click because the first click removes the label.

Other considerations

Hello @kevin91nl, thank you for this interesting streamlit component. I'd like to use it to develop a small streamlit app to tag words and build a NER dataset. Unfortunately, the issue I reported would negatively affect the user experience: when the text disappears, the page has to be reloaded and all annotations would be lost.
I think a possible solution could be to prevent the user from selecting the text of the labels: I could read the source files and try to establish the feasibility of this or other solutions but frontend is not one of my core skills.

In my app, I should be able to avoid the problem if I could access the text selection event to process it in python and not edit the input text.

Thank you for your feedback and the video! The issue is resolved in version 0.0.8. In this version, when a user selects a text that should not be selected (like the NER label), the label gets ignored and the attached word gets de-annotated (and the text doesn't disappear).