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

Adds a "Skip to main content" link. #1367

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion djangoproject/scss/_dashboard.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#dashboard {
.full-width [role="main"] {
.full-width main {
margin: 0 auto;
text-align: center;
}
Expand Down
22 changes: 19 additions & 3 deletions djangoproject/scss/_style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ h1 {
}

[role="main"] & {
main & {
@include font-size(32);
margin: 40px 0px 30px;
color: var(--body-fg);
Expand Down Expand Up @@ -155,7 +156,7 @@ h2 {
}
}

[role="main"] & {
main & {
margin-top: 40px;
margin-bottom: 15px;
}
Expand Down Expand Up @@ -232,7 +233,7 @@ a:focus {
p {

//increase top margin if first item in container
[role="main"]>&:first-child {
main>&:first-child {
margin-top: 30px;
}
}
Expand Down Expand Up @@ -270,7 +271,7 @@ blockquote {
//------------------- Layout


[role="main"] {
main {
//Main column. Left aligned by default. See /styleguide for explanation.
background: var(--white-color);
padding: 1px 10px 40px;
Expand Down Expand Up @@ -3693,3 +3694,18 @@ ul.corporate-members li {
color: var(--body-fg);
}
}

.skip-link {
position: absolute;
top: -5em;
z-index: 1;
background: var(--body-bg);
color: var(--link-color);
border: 0.5em solid var(--primary);
padding: 0.5em 2em;
transition: top 0.5s ease-out;

&:focus {
top: 0;
}
}
20 changes: 11 additions & 9 deletions djangoproject/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,19 @@

<body id="{% block sectionid %}generic{% endblock %}" class="{% block body_class %}{% endblock %}">

{% include "includes/header.html" %}
<a href="#main-content" class="skip-link">Skip to main content</a>

<div class="copy-banner">
<div class="container {% block header-classes %}{% endblock %}">
{% block header %}{% endblock %}
</div>
</div>
<div id="billboard">{% block billboard %}{% endblock %}</div>
{% include "includes/header.html" %}

<div class="container {% block layout_class %}{% endblock %}">
<div role="main">
<main id="main-content">
<div class="copy-banner">
<div class="{% block header-classes %}{% endblock %}">
{% block header %}{% endblock %}
</div>
</div>

<div id="billboard">{% block billboard %}{% endblock %}</div>

{% block messages %}
{% if messages %}
Expand All @@ -89,7 +91,7 @@

{% block content %}{% endblock %}
<a href="#top" class="backtotop"><i class="icon icon-chevron-up"></i> Back to Top</a>
</div>
</main>

{% block content-related %}{% endblock %}
{% block content-extra %}{% endblock %}
Expand Down
Loading