skip a11y-missing-content check with contenteditable bindings (#5023)

pull/5058/head
Bassam Ismail 5 years ago committed by GitHub
parent 6289dfcdcd
commit 10f7b5ee70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -706,6 +706,10 @@ export default class Element extends Node {
validate_content() { validate_content() {
if (!a11y_required_content.has(this.name)) return; if (!a11y_required_content.has(this.name)) return;
if (
this.bindings
.some((binding) => ['textContent', 'innerHTML'].includes(binding.name))
) return;
if (this.children.length === 0) { if (this.children.length === 0) {
this.component.warn(this, { this.component.warn(this, {

@ -0,0 +1,17 @@
[
{
"code": "missing-contenteditable-attribute",
"message": "'contenteditable' attribute is required for textContent and innerHTML two-way bindings",
"start": {
"line": 6,
"column": 3,
"character": 157
},
"end": {
"line": 6,
"column": 24,
"character": 178
},
"pos": 157
}
]

@ -0,0 +1,6 @@
<script>
let text = 'Hello world';
</script>
<p bind:textContent={text} contenteditable="true"></p>
<p bind:innerHTML={text} contenteditable="true"></p>
<p bind:innerHTML={text}></p>
Loading…
Cancel
Save