Hide form legend on choose reply page

The `<h1>` on this page says all the user needs to know. In research
we saw that users didn’t even read the legend, even when prompted to!
This commit is contained in:
Chris Hill-Scott
2017-11-20 16:30:51 +00:00
parent ecd43cee5e
commit 4a1dad9a66
3 changed files with 12 additions and 7 deletions

View File

@@ -2,12 +2,15 @@
field,
hint=None,
disable=[],
option_hints={}
option_hints={},
hide_legend=False
) %}
<div class="form-group {% if field.errors %} form-group-error{% endif %}">
<fieldset>
<legend class="form-label">
{{ field.label.text|safe }}
{% if hide_legend %}<span class="visually-hidden">{% endif %}
{{ field.label.text|safe }}
{% if hide_legend %}</span>{% endif %}
{% if field.errors %}
<span class="error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}">
{{ field.errors[0] }}

View File

@@ -13,10 +13,10 @@
<div class="column-three-quarters">
<form method="post">
{{ radios(
form.sender,
option_hints=option_hints
)
}}
form.sender,
option_hints=option_hints,
hide_legend=True
) }}
{{ page_footer(
'Continue',
back_link=url_for('.view_template', service_id=current_service.id, template_id=template_id),

View File

@@ -74,7 +74,9 @@ def test_show_correct_title_and_description_for_sender_type(
)
assert page.select_one('h1').text == expected_title
assert normalize_spaces(page.select_one('legend').text) == expected_description
for element in ('legend', 'legend .visually-hidden'):
assert normalize_spaces(page.select_one(element).text) == expected_description
@pytest.mark.parametrize('template_mock, sender_data', [