Fixed #32053 -- Fixed accessibility issues on the 'Congrats' page.

- Add lang attribute.
- Use the same text for the page’s main heading, and title.
- Add underlines for all links in copy.
- Stop using h2 for link to the Django page.
- Use h1 for the main heading.
- Remove useless type attribute on style element.
- Remove grey text that fails contrast checks.
- Use a shade of grey that passes AAA contrast requirements.
- Stop using h4 for footer links.
- Add full stop in block-level links so VoiceOver correctly pauses
  between runs of text.
- Hide main artwork for screen reader users.
- Update SVG icons markup to be screen-reader friendly.
- Switch options to be block-level links.
- Remove unused markup.
This commit is contained in:
Thibaud Colas 2020-09-29 00:43:19 +01:00 committed by Mariusz Felisiak
parent 20f2b822f8
commit a1215a3237
2 changed files with 73 additions and 97 deletions

View File

@ -1,19 +1,18 @@
{% load i18n %} {% load i18n %}
<!doctype html> <!doctype html>
{% get_current_language_bidi as LANGUAGE_BIDI %} {% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %}
<html dir="{{ LANGUAGE_BIDI|yesno:'rtl,ltr,auto' }}"> <html lang="{{ LANGUAGE_CODE|default:'en-us' }}" dir="{{ LANGUAGE_BIDI|yesno:'rtl,ltr,auto' }}">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>{% translate "Django: the Web framework for perfectionists with deadlines." %}</title> <title>{% translate "The install worked successfully! Congratulations!" %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="/static/admin/css/fonts.css"> <link rel="stylesheet" type="text/css" href="/static/admin/css/fonts.css">
<style type="text/css"> <style>
html { html {
line-height: 1.15; line-height: 1.15;
} }
a { a {
color: #19865C; color: #19865C;
text-decoration: none;
} }
header { header {
border-bottom: 1px solid #efefef; border-bottom: 1px solid #efefef;
@ -43,22 +42,16 @@
} }
.logo { .logo {
float: left; float: left;
}
.logo h2 {
font-weight: 700; font-weight: 700;
margin-top: 0px; font-size: 1.375rem;
text-decoration: none;
} }
.release-notes { .release-notes {
float: right; float: right;
margin-top: 7px; margin-top: 7px;
} }
.release-notes p {
font-size: 14px;
}
.figure { .figure {
margin-top: 19vh; margin-top: 19vh;
}
.figure__animation {
max-width: 265px; max-width: 265px;
position: relative; position: relative;
z-index: -9; z-index: -9;
@ -104,17 +97,15 @@
animation: none; animation: none;
} }
} }
h2 { h1 {
font-size: 22px; font-size: 1.375rem;
max-width: 500px; max-width: 32rem;
margin: 5px auto 0; margin: 5px auto 0;
} }
main p { main p {
font-size: 16px; line-height: 1.25;
line-height: 20px; max-width: 26rem;
max-width: 410px;
margin: 15px auto 0; margin: 15px auto 0;
color: #888888;
} }
footer { footer {
padding: 25px 0; padding: 25px 0;
@ -127,14 +118,16 @@
border-top: 1px solid #efefef; border-top: 1px solid #efefef;
} }
.option { .option {
display: block;
float: left; float: left;
width: 33.33%; width: 33.33%;
box-sizing: border-box; box-sizing: border-box;
padding-right: 5px; padding-right: 5px;
text-decoration: none;
} }
.option svg { .option svg {
width: 25px; width: 1.5rem;
height: 25px; height: 1.5rem;
fill: gray; fill: gray;
border: 1px solid #d6d6d6; border: 1px solid #d6d6d6;
padding: 5px; padding: 5px;
@ -142,26 +135,21 @@
float: left; float: left;
margin-right: 10px; margin-right: 10px;
} }
.option div {
display: table;
}
.option h4 {
color: #19865C;
font-size: 19px;
}
.option p { .option p {
font-weight: 300; font-weight: 300;
font-size: 15px; line-height: 1.25;
padding-top: 3px; color: #525252;
color: #757575; display: table;
}
.option .option__heading {
color: #19865C;
font-size: 1.25rem;
font-weight: 400;
} }
@media (max-width: 996px) { @media (max-width: 996px) {
body, footer { body, footer {
max-width: 780px; max-width: 780px;
} }
.logo h2 {
margin-left: 0px;
}
} }
@media (max-width: 800px) { @media (max-width: 800px) {
footer, main { footer, main {
@ -192,11 +180,8 @@
main { main {
padding: 0 25px; padding: 0 25px;
} }
main h2 { main h1 {
font-size: 18px; font-size: 1.25rem;
}
main p {
font-size: 14px;
} }
header { header {
padding-left: 20px; padding-left: 20px;
@ -222,22 +207,28 @@
margin-top: 50px; margin-top: 50px;
} }
} }
.sr-only {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
</style> </style>
</head> </head>
<body> <body>
<header class="u-clearfix"> <header class="u-clearfix">
<div class="logo"> <a class="logo" href="https://www.djangoproject.com/" target="_blank" rel="noopener">
<a href="https://www.djangoproject.com/" target="_blank" rel="noopener"> django
<h2>django</h2>
</a> </a>
</div>
<div class="release-notes"> <div class="release-notes">
<p>{% blocktranslate %}View <a href="https://docs.djangoproject.com/en/{{ version }}/releases/" target="_blank" rel="noopener">release notes</a> for Django {{ version }}{% endblocktranslate %}</p> <p>{% blocktranslate %}View <a href="https://docs.djangoproject.com/en/{{ version }}/releases/" target="_blank" rel="noopener">release notes</a> for Django {{ version }}{% endblocktranslate %}</p>
</div> </div>
</header> </header>
<main> <main>
<div class="figure"> <svg class="figure" viewBox="0 0 508 268" aria-hidden="true">
<svg class="figure__animation" viewBox="0 0 508 268">
<path d="M305.2 156.6c0 4.6-.5 9-1.6 13.2-2.5-4.4-5.6-8.4-9.2-12-4.6-4.6-10-8.4-16-11.2 2.8-11.2 4.5-22.9 5-34.6 1.8 1.4 3.5 2.9 5 4.5 10.5 10.3 16.8 24.5 16.8 40.1zm-75-10c-6 2.8-11.4 6.6-16 11.2-3.5 3.6-6.6 7.6-9.1 12-1-4.3-1.6-8.7-1.6-13.2 0-15.7 6.3-29.9 16.6-40.1 1.6-1.6 3.3-3.1 5.1-4.5.6 11.8 2.2 23.4 5 34.6z" fill="#2E3B39" fill-rule="nonzero"/> <path d="M305.2 156.6c0 4.6-.5 9-1.6 13.2-2.5-4.4-5.6-8.4-9.2-12-4.6-4.6-10-8.4-16-11.2 2.8-11.2 4.5-22.9 5-34.6 1.8 1.4 3.5 2.9 5 4.5 10.5 10.3 16.8 24.5 16.8 40.1zm-75-10c-6 2.8-11.4 6.6-16 11.2-3.5 3.6-6.6 7.6-9.1 12-1-4.3-1.6-8.7-1.6-13.2 0-15.7 6.3-29.9 16.6-40.1 1.6-1.6 3.3-3.1 5.1-4.5.6 11.8 2.2 23.4 5 34.6z" fill="#2E3B39" fill-rule="nonzero"/>
<path d="M282.981 152.6c16.125-48.1 6.375-104-29.25-142.6-35.625 38.5-45.25 94.5-29.25 142.6h58.5z" stroke="#FFF" stroke-width="3.396" fill="#6DDCBD"/> <path d="M282.981 152.6c16.125-48.1 6.375-104-29.25-142.6-35.625 38.5-45.25 94.5-29.25 142.6h58.5z" stroke="#FFF" stroke-width="3.396" fill="#6DDCBD"/>
<path d="M271 29.7c-4.4-10.6-9.9-20.6-16.6-29.7-6.7 9-12.2 19-16.6 29.7H271z" stroke="#FFF" stroke-width="3" fill="#2E3B39"/> <path d="M271 29.7c-4.4-10.6-9.9-20.6-16.6-29.7-6.7 9-12.2 19-16.6 29.7H271z" stroke="#FFF" stroke-width="3" fill="#2E3B39"/>
@ -248,51 +239,36 @@
<path class="exhaust__line" fill="#E6E9EE" d="M250 172h7v90h-7z"/> <path class="exhaust__line" fill="#E6E9EE" d="M250 172h7v90h-7z"/>
<path class="flame" d="M250.27 178.834l-5.32-8.93s-2.47-5.7 3.458-6.118h10.26s6.232.266 3.306 6.194l-5.244 8.93s-3.23 4.37-6.46 0v-.076z" fill="#AA2247"/> <path class="flame" d="M250.27 178.834l-5.32-8.93s-2.47-5.7 3.458-6.118h10.26s6.232.266 3.306 6.194l-5.244 8.93s-3.23 4.37-6.46 0v-.076z" fill="#AA2247"/>
</svg> </svg>
</div> <h1>{% translate "The install worked successfully! Congratulations!" %}</h1>
<h2>{% translate "The install worked successfully! Congratulations!" %}</h2>
<p>{% blocktranslate %}You are seeing this page because <a href="https://docs.djangoproject.com/en/{{ version }}/ref/settings/#debug" target="_blank" rel="noopener">DEBUG=True</a> is in your settings file and you have not configured any URLs.{% endblocktranslate %}</p> <p>{% blocktranslate %}You are seeing this page because <a href="https://docs.djangoproject.com/en/{{ version }}/ref/settings/#debug" target="_blank" rel="noopener">DEBUG=True</a> is in your settings file and you have not configured any URLs.{% endblocktranslate %}</p>
</main> </main>
<footer class="u-clearfix"> <footer class="u-clearfix">
<a href="https://docs.djangoproject.com/en/{{ version }}/" target="_blank" rel="noopener"> <a class="option one" href="https://docs.djangoproject.com/en/{{ version }}/" target="_blank" rel="noopener">
<div class="option one"> <svg viewBox="0 0 24 24" aria-hidden="true">
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <path d="M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6A4.997 4.997 0 017 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z"></path>
<defs>
<path d="M0 0h24v24H0V0z" id="a"></path>
</defs>
<clipPath id="b">
<use overflow="visible" xlink:href="#a"></use>
</clipPath>
<path clip-path="url(#b)" d="M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z"></path>
</svg> </svg>
<div> <p>
<h4>{% translate "Django Documentation" %}</h4> <span class="option__heading">{% translate "Django Documentation" %}</span><span class="sr-only">.</span><br>
<p>{% translate 'Topics, references, &amp; how-tos' %}</p> {% translate 'Topics, references, &amp; how-tos' %}
</div> </p>
</div>
</a> </a>
<a href="https://docs.djangoproject.com/en/{{ version }}/intro/tutorial01/" target="_blank" rel="noopener"> <a class="option two" href="https://docs.djangoproject.com/en/{{ version }}/intro/tutorial01/" target="_blank" rel="noopener">
<div class="option two"> <svg viewBox="0 0 24 24" aria-hidden="true">
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0V0z" fill="none"></path>
<path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"></path> <path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"></path>
</svg> </svg>
<div> <p>
<h4>{% translate "Tutorial: A Polling App" %}</h4> <span class="option__heading">{% translate "Tutorial: A Polling App" %}</span><span class="sr-only">.</span><br>
<p>{% translate "Get started with Django" %}</p> {% translate "Get started with Django" %}
</div> </p>
</div>
</a> </a>
<a href="https://www.djangoproject.com/community/" target="_blank" rel="noopener"> <a class="option three" href="https://www.djangoproject.com/community/" target="_blank" rel="noopener">
<div class="option three"> <svg viewBox="0 0 24 24" aria-hidden="true">
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"></path>
<path d="M16.5 13c-1.2 0-3.07.34-4.5 1-1.43-.67-3.3-1-4.5-1C5.33 13 1 14.08 1 16.25V19h22v-2.75c0-2.17-4.33-3.25-6.5-3.25zm-4 4.5h-10v-1.25c0-.54 2.56-1.75 5-1.75s5 1.21 5 1.75v1.25zm9 0H14v-1.25c0-.46-.2-.86-.52-1.22.88-.3 1.96-.53 3.02-.53 2.44 0 5 1.21 5 1.75v1.25zM7.5 12c1.93 0 3.5-1.57 3.5-3.5S9.43 5 7.5 5 4 6.57 4 8.5 5.57 12 7.5 12zm0-5.5c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm9 5.5c1.93 0 3.5-1.57 3.5-3.5S18.43 5 16.5 5 13 6.57 13 8.5s1.57 3.5 3.5 3.5zm0-5.5c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2z"></path> <path d="M16.5 13c-1.2 0-3.07.34-4.5 1-1.43-.67-3.3-1-4.5-1C5.33 13 1 14.08 1 16.25V19h22v-2.75c0-2.17-4.33-3.25-6.5-3.25zm-4 4.5h-10v-1.25c0-.54 2.56-1.75 5-1.75s5 1.21 5 1.75v1.25zm9 0H14v-1.25c0-.46-.2-.86-.52-1.22.88-.3 1.96-.53 3.02-.53 2.44 0 5 1.21 5 1.75v1.25zM7.5 12c1.93 0 3.5-1.57 3.5-3.5S9.43 5 7.5 5 4 6.57 4 8.5 5.57 12 7.5 12zm0-5.5c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm9 5.5c1.93 0 3.5-1.57 3.5-3.5S18.43 5 16.5 5 13 6.57 13 8.5s1.57 3.5 3.5 3.5zm0-5.5c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2z"></path>
</svg> </svg>
<div> <p>
<h4>{% translate "Django Community" %}</h4> <span class="option__heading">{% translate "Django Community" %}</span><span class="sr-only">.</span><br>
<p>{% translate "Connect, get help, or contribute" %}</p> {% translate "Connect, get help, or contribute" %}
</div> </p>
</div>
</a> </a>
</footer> </footer>
</body> </body>

View File

@ -243,7 +243,7 @@ class DebugViewTests(SimpleTestCase):
response = self.client.get('/') response = self.client.get('/')
self.assertContains( self.assertContains(
response, response,
"<h2>The install worked successfully! Congratulations!</h2>" "<h1>The install worked successfully! Congratulations!</h1>"
) )
@override_settings(ROOT_URLCONF='view_tests.regression_21530_urls') @override_settings(ROOT_URLCONF='view_tests.regression_21530_urls')