Hotwire Discussion

turbo:submit-start->chat#attemptSend dosent stop the form from being submitted

Hi, so i have this basic form

    <%= form_for [@conversation, @conversation.messages.new],
                       html: {data: { controller: "reset-form chat", action: "turbo:submit-end->reset-form#reset turbo:submit-start->chat#attemptSendMessage"}} do |f| %>
      

and the controller

    attemptSendMessage(e) {
        e.preventDefault();
        if(this.inputTarget.value.trim().length === 0) {
            this.inputTarget.classList.add("border-red-500");
        } else {
            this.submitTarget.click();
        }
    }

the e.preventDefault() is being executed but the form is still gets submitted

Any ideas why?

When i click enter on the keyboard this behavior occurs