Detailed answer
It lets people edit a region, but does not create a full editor or a standard form field.
Saving, naming, keyboard behavior, and pasted content still need handling. Treat edited content as untrusted when storing or sharing it. Prefer native fields when a simple text input is sufficient.
Example
<div contenteditable="true" role="textbox" aria-label="Editable lesson note">Write an HTML note.</div>
Understanding the behavior
Contenteditable makes a region editable but does not provide a complete editor, form submission, storage or sanitization system. Pasted content can include formatting and unexpected markup. A conventional textarea may be more appropriate for plain text input.
Practical implementation notes
Test keyboard navigation, paste, undo and saving. Treat edited HTML as untrusted when it is stored or displayed elsewhere, and provide an accessible name and clear instructions for the editing region.
How to check it
Define the save flow explicitly and test pasted markup before storing anything.
Expected result
Editing, persistence, and sanitization are treated as separate responsibilities.
Watch out: Do not publish raw edited HTML without appropriate sanitization.
Read the reference ↗