Skip to content
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

Merged
merged 7 commits into from
Feb 25, 2024

Conversation

shyusu4
Copy link
Member

@shyusu4 shyusu4 commented Feb 5, 2024

This PR addresses accessibility issues related to heading levels and forms:

  • Fixed instances (in hero, headline, and icon-link blocks) where headings were used consecutively after one another.
  • Changed menu_get_started to use an h2
  • Decorative shapes overlap section subheadings #457
  • Sign up form styling #459
  • Currently screen reader announces sign up forms on the site with "Enter your email address" repeated 3 times. Fixed by changing base_form to use aria-label="Email" instead of <label>
  • Changes the use of fieldset in search-form to a div (fieldset is used to group multiple form fields together, but there's only one here)
Screenshots
before after
Screenshot (109) Screenshot (105)
Screenshot (110) Screenshot (106)

@shyusu4 shyusu4 marked this pull request as ready for review February 6, 2024 12:09
@Scotchester
Copy link

Fixed instances (in hero, headline, and icon-link blocks) where headings were used consecutively after one another.

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 hgroup elements. They're probably harmless in the short term, but according to MDN, they have been removed from the HTML spec and are discouraged from being used. If a wrapper is helpful for applying the role="group" aria-roledescription="heading group" attributes, a div is probably best in this case.

Copy link

@Morsey187 Morsey187 left a 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 %}

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

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.

Example Screenshot 2024-02-06 at 16 02 54

width: 170px;
height: 170px;

@include media-query(medium) {
inset: -100px 0 auto auto;
Copy link

@Morsey187 Morsey187 Feb 6, 2024

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.

Example Screenshot 2024-02-06 at 17 39 07

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.

Example using flex You could then use `flex-direction: column` to move the icon below the form at mobile viewports. We also wouldn't have to offset the image using CSS which can be tricky to manage (as proven by the original code). Screenshot 2024-02-06 at 17 44 03

Copy link
Member

@thibaudcolas thibaudcolas left a 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">
Copy link
Member

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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<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/>
Copy link
Member

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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
</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">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

Copy link
Member

@thibaudcolas thibaudcolas left a 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!

@thibaudcolas thibaudcolas merged commit c1035b6 into wagtail:main Feb 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

4 participants