diff --git a/packages/web-twig/src/Resources/components/Accordion/Accordion.twig b/packages/web-twig/src/Resources/components/Accordion/Accordion.twig
index 6c03b6c2cb..d78275feee 100644
--- a/packages/web-twig/src/Resources/components/Accordion/Accordion.twig
+++ b/packages/web-twig/src/Resources/components/Accordion/Accordion.twig
@@ -7,7 +7,7 @@
{%- set _rootClassName = _spiritClassPrefix ~ 'Accordion' -%}
{# Attributes #}
-{%- set _idAttr = _id ? 'id=' ~ _id : null -%}
+{%- set _idAttr = _id ? 'id="' ~ _id | escape('html_attr') ~ '"' : null -%}
{# Miscellaneous #}
{%- set _styleProps = useStyleProps(props) -%}
@@ -17,7 +17,7 @@
<{{ _elementType }}
{{ mainProps(_mainPropsWithoutId) }}
{{ styleProp(_styleProps) }}
- {{ _idAttr }}
+ {{ _idAttr | raw }}
{{ classProp(_classNames) }}
data-toggle="accordion"
>
diff --git a/packages/web-twig/src/Resources/components/Accordion/AccordionContent.twig b/packages/web-twig/src/Resources/components/Accordion/AccordionContent.twig
index 38a1654175..af106b5343 100644
--- a/packages/web-twig/src/Resources/components/Accordion/AccordionContent.twig
+++ b/packages/web-twig/src/Resources/components/Accordion/AccordionContent.twig
@@ -12,9 +12,9 @@
{%- set _isOpenClassName = _isOpen ? 'is-open' : null -%}
{# Attributes #}
-{%- set _idAttr = _id ? 'id=' ~ _id : null -%}
-{%- set _labelledIdAttr = _labelledById ? 'aria-labelledby=' ~ _labelledById : null -%}
-{%- set _dataParentAttr = _parent ? 'data-parent=' ~ _parent : null -%}
+{%- set _idAttr = _id ? 'id="' ~ _id | escape('html_attr') ~ '"' : null -%}
+{%- set _labelledIdAttr = _labelledById ? 'aria-labelledby="' ~ _labelledById | escape('html_attr') ~ '"' : null -%}
+{%- set _dataParentAttr = _parent ? 'data-parent="' ~ _parent | escape('html_attr') ~ '"' : null -%}
{# Miscellaneous #}
{%- set _styleProps = useStyleProps(props) -%}
@@ -25,10 +25,10 @@
diff --git a/packages/web-twig/src/Resources/components/Accordion/AccordionHeader.twig b/packages/web-twig/src/Resources/components/Accordion/AccordionHeader.twig
index 18d2208b9b..af8fd9e7b5 100644
--- a/packages/web-twig/src/Resources/components/Accordion/AccordionHeader.twig
+++ b/packages/web-twig/src/Resources/components/Accordion/AccordionHeader.twig
@@ -14,8 +14,8 @@
{%- set _iconClassName = _spiritClassPrefix ~ 'Accordion__itemIcon' -%}
{# Attributes #}
-{%- set _idAttr = _id ? 'id=' ~ _id : null -%}
-{%- set _dataTargetAttr = _for ? 'data-target=' ~ _for : null -%}
+{%- set _idAttr = _id ? 'id="' ~ _id | escape('html_attr') ~ '"' : null -%}
+{%- set _dataTargetAttr = _for ? 'data-target="' ~ _for | escape('html_attr') ~ '"' : null -%}
{# Miscellaneous #}
{%- set _styleProps = useStyleProps(props) -%}
@@ -26,14 +26,14 @@
<{{ _elementType }}
{{ mainProps(_mainPropsWithoutId) }}
{{ styleProp(_styleProps) }}
- {{ _idAttr }}
+ {{ _idAttr | raw }}
{{ classProp(_classNames) }}
>