Open vanillajonathan opened 4 months ago
The user agents, bots, and scripts know nothing of the content of the textarea and cannot provide syntax highlighting or input validation.
The textarea element does convey semantics as to what the content is other than its natural language via the lang attribute.
textarea
lang
None, but you can use your own custom data- attributes but then there is no standard for it and it only works with your scripts.
data-
You can use JavaScript libraries such as Ace, CodeMirror or Monaco if you want a nice experience but the markup has no semantics.
Add a attribute to to the textarea element.
Example:
<textarea enctype="application/json">{}</textarea>
or:
<textarea codelang="python">fruits = ["apple", "banana", "orange"]</textarea>
No response
Related issue https://github.com/WICG/proposals/issues/136
What problem are you trying to solve?
The user agents, bots, and scripts know nothing of the content of the textarea and cannot provide syntax highlighting or input validation.
The
textarea
element does convey semantics as to what the content is other than its natural language via thelang
attribute.What solutions exist today?
None, but you can use your own custom
data-
attributes but then there is no standard for it and it only works with your scripts.You can use JavaScript libraries such as Ace, CodeMirror or Monaco if you want a nice experience but the markup has no semantics.
How would you solve it?
Add a attribute to to the
textarea
element.Example:
or:
Anything else?
No response