Phenomenon
The pattern attribute, which allows regex-based validation on form inputs, does not work on contenteditable regions. Content cannot be validated against a pattern.
Reproduction example
- Create a contenteditable div with
pattern="[0-9]+"(numbers only). - Type non-numeric characters.
- Observe whether validation occurs.
Observed behavior
- In Firefox on Windows, the
patternattribute is ignored on contenteditable. - No validation occurs.
- Invalid content can be entered freely.
Expected behavior
- The
patternattribute should validate contenteditable content. - Invalid content should be rejected or flagged.
- Or, there should be a standard way to validate content against patterns.