From f3807df59e66e8b9301803365ba93b411802cf3b Mon Sep 17 00:00:00 2001 From: vibovenkat123 Date: Tue, 21 Feb 2023 20:15:15 -0600 Subject: [PATCH] fix: instead of deleting, add a new attribute to class instead of deleting the element from the Set, add a new attribute to to indicate it doesnt need a child --- src/compiler/compile/nodes/Element.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts index 3f4d270e6a..123fb8d51c 100644 --- a/src/compiler/compile/nodes/Element.ts +++ b/src/compiler/compile/nodes/Element.ts @@ -225,6 +225,7 @@ export default class Element extends Node { namespace: string; needs_manual_style_scoping: boolean; tag_expr: Expression; + contains_a11y_label: boolean; get is_dynamic_element() { return this.name === 'svelte:element'; @@ -644,7 +645,7 @@ export default class Element extends Node { if (aria_label_attribute) { const aria_value = aria_label_attribute.get_static_value(); if (aria_value != '') { - a11y_required_content.delete('a'); + this.contains_a11y_label = true; } } if (href_attribute) { @@ -927,6 +928,7 @@ export default class Element extends Node { validate_content() { if (!a11y_required_content.has(this.name)) return; + if (this.contains_a11y_label) return; if ( this.bindings .some((binding) => ['textContent', 'innerHTML'].includes(binding.name))