I try to add a CSS class sr-only
to the label of my Views exposed form.
In form-element-label.html.twig
I added:
{% if title is not empty or required -%} <label{{ attributes.addClass(classes) }}>{{ title }}</label> {% elseif title['#markup'] == "Search" %} <label{{ attributes.addClass('sr-only') }}>{{ title }}</label> {%- endif %}
When I debug {{ kint(title) }}
I get:
What I’m doing wrong?