text_input placeholder not resetting

I have a custom recipe combining classification and text_input interfaces. I'm finding that the text input box is not resetting, and the box is not getting autofocus (except for the first sample). When a new sample comes up, the text input box keeps whatever input I gave for the previous sample, but if I accept the user-input is not saved.

Code for the recipe:

@prodigy.recipe(
    "label-clusters",
    dataset=("The dataset to save to", "positional", None, str),
    file_path=("File with jsonl list of images", "positional", None, str),
    label=("Comma-separated label(s)", "option", "l"),
)
def label_clusters(dataset, file_path, label):
    blocks = [
        {"view_id": "classification"},
        {"view_id": "text_input"},
    ]
    def get_stream():
        stream = JSONL(file_path)
        for eg in stream:
            eg["field_id"] = "cluster_label"
            eg["field_placeholder"] = ""
            eg["field_autofocus"] = True
            yield eg

    return {
        "dataset": dataset,
        "view_id": "blocks",
        "config": {
            "blocks": blocks
        },
        "stream": get_stream(),
    }

A line in the input file looks like: {"image": "http://127.0.0.1:8282/lc_11.png", "width": 800, "height": 800, "label": "cluster"}. I also tried adding the field_* keys to the input file, with the same result.

Am I misusing this interface somehow?

Thanks for the report – I tracked down the problem and the fix will be included in the next release :slightly_smiling_face: The underlying issue was that the field wasn't always resetting itself visually – so if you move on to the next task, the field value is empty (as it should be), but the UI still displayed the previous text. If you edit the text, the field value will be updated, as expected.

The autofocus issue was related, so this should also be resolved with the fix. The "field_placeholder" is only the input field placeholder like "Type here..." btw – this is handled automatically by the browser and has no influence on the value.

1 Like

Okay, should be fixed in v1.9.7, which was just released :slightly_smiling_face:

I was facing the exact same issue and can confirm than the problem is solved in v1.9.7 :smile:

1 Like