-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Headings and forms accessibility improvements #458
Headings and forms accessibility improvements #458
Conversation
I looked for an issue in the audit spreadsheet that this addresses but couldn't easily find one. Could you point it out for me? I'm a bit concerned about the addition of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, I haven't looked so much into the use of aria tags and hgroup as I noticed Scot's comment and certain things were discussed already on Zoom so I think Thibaud is better placed to review that aspect.
Instead I've checked out the branch and tested locally, the SCSS looks fine to me I've just left some nickpicks/suggestions around text overlapping.
{% if value.sub_heading or value.subheading %} | ||
<h2 class="hero__subheading intro-big">{% firstof value.sub_heading value.subheading %}</h2> | ||
{% endif %} | ||
{% if value.sub_heading or value.subheading %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nickpick: Not related to your code at all, but value
here has been assigned a page instance though the hero template tag, unfortunately the FeatureIndexPage
has a field defined as subheading
, instead of sub_heading
which is used else where.
Modifying subheading
to sub_heading
would be a nice way to improve the codebase and an opportunity to become familiar with django migrations.
Although this is out of scope so feel free to ignore.
|
||
&__heading { | ||
|
||
@include media-query(large) { | ||
width: 120%; // to get a bit of overlap on the icon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested fix
Make sure icons are always behind text elements in z-index layering or/and add a solid background according to theme behind the text.
Question: Just to comment on the suggested fix here, there is quite a lot of overlap with icons and text at mobile, this could effect the readability in terms of contrast as well as the overall readability of the text (although likely difficult to know without real usability testing).
I was wondering if you considered applying a background colour to headline__inner
perhaps one with some transparency if not wanting to cut the icons out too much but still wanting to provide better contrast.
width: 170px; | ||
height: 170px; | ||
|
||
@include media-query(medium) { | ||
inset: -100px 0 auto auto; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nickpick: This is a huge improvement over the current styling, however it's still possble to have the text overlap at some viewports, which given the bright colour of the icon here makes the text really difficuly to read.
If you altered the DOM a little, you could then constrain the text to a division element and have both the text and icon be responsive to their respective containers, using display: flex
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few things that need changing, and I think more work needed on the text overlap, but this goes in the right direction.
@@ -3,11 +3,13 @@ | |||
<div class="grid"> | |||
<div class="hero {% if classes %}{{ classes }}{% endif %}"> | |||
<div class="hero__inner"> | |||
<h1 class="hero__heading">{% firstof value.heading value.title %}</h1> | |||
<hgroup role="group" aria-roledescription="heading group"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hgroup
makes sense to me semantically. I don’t think we’d need the role
though as group
is the default role for that element. aria-roledescription
feels way too advanced of a property for the problem at hand, would prefer we avoid using this unless there’s a very specific problem we’re wanting to solve.
<h2 class="hero__subheading intro-big">{% firstof value.sub_heading value.subheading %}</h2> | ||
{% endif %} | ||
{% if value.sub_heading or value.subheading %} | ||
<p aria-roledescription="subheading" class="hero__subheading intro-big">{% firstof value.sub_heading value.subheading %}</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<p aria-roledescription="subheading" class="hero__subheading intro-big">{% firstof value.sub_heading value.subheading %}</p> | |
<p class="hero__subheading intro-big">{% firstof value.sub_heading value.subheading %}</p> |
@@ -3,8 +3,7 @@ <h2 class="sign-up-form__heading heading-three">{{ heading }}</h2> | |||
<p class="sign-up-form__sub-heading">{{ sub_heading }}</p> | |||
<form class="sign-up-form__container" action="https://torchbox.us1.list-manage.com/subscribe/post?u={{ mailchimp_account_id }}&id={{ mailchimp_newsletter_id }}" method="post"> | |||
<div> | |||
<label for="email" class="u-sr-only">Enter your email address</label> | |||
<input class="sign-up-form__input" id="email" name="EMAIL" type="email" autocomplete="email" placeholder="Enter your email address" required/> | |||
<input class="sign-up-form__input" id="email" name="EMAIL" type="email" autocomplete="email" placeholder="Enter your email address" aria-label="Email" required/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
</div> | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
</div> | |
</div> | |
@@ -1,10 +1,10 @@ | |||
<form action="{% url 'search' %}" method="get" role="search" class="search {% if classes %}{{ classes }}{% endif %}" {% if data_attrs %}{{ data_attrs }}{% endif %} {% if form_id %}id="{{ form_id }}"{% endif %}> | |||
<fieldset class="search__wrap"> | |||
<div class="search__wrap"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging without the role
and aria-roledescription
usage!
This PR addresses accessibility issues related to heading levels and forms:
h2
aria-label="Email"
instead of<label>
fieldset
in search-form to adiv
(fieldset is used to group multiple form fields together, but there's only one here)Screenshots