Skip to content

Commit

Permalink
♿ [#4720] Skiplink as first focusable element and visible on focus
Browse files Browse the repository at this point in the history
  • Loading branch information
robinmolen authored and sergei-maertens committed Oct 28, 2024
1 parent 2cfc111 commit 28978f4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/openforms/templates/404.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends 'master.html' %}

{% block extra_css %}{% endblock %}
{% block skiplink %}{% endblock %}

{% block content %}
<h1>Sorry, the requested page could not be found (404)</h1>
Expand Down
1 change: 1 addition & 0 deletions src/openforms/templates/account_blocked.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends 'master.html' %}

{% block extra_css %}{% endblock %}
{% block skiplink %}{% endblock %}

{% block content %}

Expand Down
8 changes: 5 additions & 3 deletions src/openforms/templates/master.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
</head>

<body class="utrecht-page">
{% block skiplink %}
<a class="skiplink" href="#main-content">{% translate "Show content." %}</a>
{% endblock %}

{# No point in putting this in a <template> tag, since it targets noscript #}
{% if enable_analytics and analytics_tools_config.enable_google_analytics and analytics_tools_config.gtm_code %}
{# Load the second part of the Google tag manager snippet #}
Expand All @@ -42,12 +46,10 @@
{% block content %}
{% block header %}
{% include "includes/page-header.html" %}
<a class="skiplink" href="#main-content">{% translate "Show content." %}</a>
{% endblock %}

<div class="utrecht-page__content utrecht-page-content">
<main class="utrecht-page-content__main">
<span class="skiplink-target" id="main-content"></span>
<main class="utrecht-page-content__main" id="main-content">
{% block inner-content %}
Override <code>{% verbatim %}{% block inner-content %}{% endverbatim %}</code>
to get some actual content.
Expand Down
13 changes: 11 additions & 2 deletions src/openforms/ui/static/ui/scss/components/skiplink/_skiplink.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
.skiplink {
position: absolute;
top: -100vh;
left: -100vh;
padding: 6px;
background-color: var(--of-skiplink-bg, var(--of-button-primary-bg));
color: var(--of-skiplink-fg, var(--of-button-primary-fg));
border-bottom-right-radius: 6px;
border-right: 1px solid var(--of-skiplink-color-border, var(--of-button-primary-color-border));
border-bottom: 1px solid var(--of-skiplink-color-border, var(--of-button-primary-color-border));

&:not(&:focus) {
top: -100vh;
left: -100vh;
}

@media print {
display: none;
Expand Down

0 comments on commit 28978f4

Please sign in to comment.