Skip to content

Commit

Permalink
Escape filter label consistently (#3192)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludoboludo committed Jan 15, 2024
1 parent bfa56e0 commit b700fc9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions snippets/facets.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<facet-remove>
<a href="{{ value.url_to_remove }}" class="active-facets__button active-facets__button--light">
<span class="active-facets__button-inner button button--tertiary">
{{ filter.label }}: {{ value.label | escape }}
{{ filter.label | escape }}: {{ value.label | escape }}

This comment has been minimized.

Copy link
@bakura10

bakura10 Jan 21, 2024

escape filter should only be used when outputting inside an HTML attribute. I remember that I experienced some issues when having special characters and using escape like this when it was not needed (for instance if the text contains ampersand & character, escaping would modify it).

{% render 'icon-close-small' %}
<span class="visually-hidden">{{ 'products.facets.clear_filter' | t }}</span>
</span>
Expand Down Expand Up @@ -138,7 +138,7 @@
>
<summary
class="facets__summary caption-large focus-offset"
aria-label="{{ filter.label }} ({{ 'products.facets.filters_selected.one' | t: count: filter.active_values.size }})"
aria-label="{{ filter.label | escape }} ({{ 'products.facets.filters_selected.one' | t: count: filter.active_values.size }})"
>
<div>
<span class="facets__summary-label">
Expand Down Expand Up @@ -470,7 +470,7 @@
<facet-remove>
<a href="{{ value.url_to_remove }}" class="active-facets__button active-facets__button--light">
<span class="active-facets__button-inner button button--tertiary">
{{ filter.label }}: {{ value.label | escape }}
{{ filter.label | escape }}: {{ value.label | escape }}
{% render 'icon-close-small' %}
<span class="visually-hidden">{{ 'products.facets.clear_filter' | t }}</span>
</span>
Expand Down Expand Up @@ -1033,7 +1033,7 @@
<facet-remove>
<a href="{{ value.url_to_remove }}" class="active-facets__button active-facets__button--light">
<span class="active-facets__button-inner button button--tertiary">
{{ filter.label }}: {{ value.label | escape }}
{{ filter.label | escape }}: {{ value.label | escape }}
{% render 'icon-close-small' %}
<span class="visually-hidden">{{ 'products.facets.clear_filter' | t }}</span>
</span>
Expand Down Expand Up @@ -1150,7 +1150,7 @@
<facet-remove>
<a href="{{ value.url_to_remove }}" class="active-facets__button active-facets__button--light">
<span class="active-facets__button-inner button button--tertiary">
{{ filter.label }}: {{ value.label | escape }}
{{ filter.label | escape }}: {{ value.label | escape }}
{% render 'icon-close-small' %}
<span class="visually-hidden">{{ 'products.facets.clear_filter' | t }}</span>
</span>
Expand Down

0 comments on commit b700fc9

Please sign in to comment.