st.form(enter_to_submit=True) incompatible with st.text_area?

Is st.form(enter_to_submit=True) compatible with st.text_area?

When I have a text_area inside of such a form, the text_area says “Press [cmd]+Enter to submit form”. But when I do that, the text_area value is empty. Not sure if I am doing this wrong?

with st.form(key="my_form", enter_to_submit=True):
    feedback = st.text_area("Add feedback here")
    submit = st.form_submit_button("Send")
    if submit:
        logger.info(f"Feedback: {feedback}")

If I click the “Send” button, it works. If I press [cmd]+Enter, then the logger outputs an empty feedback. Is this a race condition between the form submit and the text_area?

If this is expected behavior, the messaging of “Press cmd+Enter to submit form” inside of the text area is confusing and should be changed.

1 Like

I too am getting the same issue.

My picture above shows the first empty radio options were a result of enter_on_submit = True. But the last was clicking on submit.