Pressing "Enter" button while typing in a markdown input, the form submit is triggered
Describe the bug
In a markdown field, if a user hits "Enter" button on their keyboard, the form get submitted instead of adding a new line.
To Reproduce
Steps to reproduce the behavior:
- Created a content type
- add a Markdown field with standard editor
- Create a new content item of that content type
- focus the field input and click "enter"
Expected behavior
When "Enter" in clicked, I expect a new line to be inserted instead of form submitting.
Is the same thing happen in Html field?
I don't think so. At least I don't think I recall experiencing this issue outside a standard Markdown field.
This is something that generally we would think that it be part of the Markdown editor itself. Looks like it is a regression from previous versions else it would have been reported way before.
@Skrypt I have not had time to look into it. But it works fine when you use textarea. The issue is when using a standard input. Maybe it does not like the input type? Not sure. I'll try to look into it when I have time.
At the same time, why do we even use a text input for a markdown by default? How can that ever be useful? Maybe the standard markdown should be textarea? Is there a good reason why markdown would be used in a in standard text input?
AFAIK textarea support enter key while others triggers the default submit button on the page. So, using textarea should fix the issue
@hishamco changing it would fix the issue. But at the same time we have Textarea editor for Markdown. I don't know if there is a valid reason why the standard editor uses an text input.
Really I don't know!! I'm expecting using TextArea for such editors
Apparently it a standard html behavior that for some reason I never paid attention to it. Anytime you hit enter while typing in html input of a type text will submit the form. So I don't think this is an issue.
I don't know if text make sense for markdown, so I suggest we change it to textarea.
Anytime you hit enter while typing in html input of a type text will submit the form. So I don't think this is an issue.
That's what I refered too here
Would you use Multi-line or WYSIWYG as the default editor?
Yes using Multi-line or WYSIWYG works just fine. I think the problem here was that the Markdown part use textarea by default. I think it may not be a bad idea to use Multi-line "textarea" by default drop the support for a single-line. Single-line is not useful when writing markdown.
Let's do multi-line for the lack of dependencies, then.