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

♿️(styles) improve the offscreen class #1645

Merged
merged 1 commit into from
Mar 24, 2022
Merged
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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
excerpt, Program body and Person main content
- Use anchors instead of buttons in search pagination to let users open pages
in new tabs if they want
- Improve the `offscreen` class implementation to prevent potential visual
issues for sighted user keyboards

### Fixed

Expand Down
26 changes: 13 additions & 13 deletions src/frontend/scss/generic/_accessibility.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@
// to users that need it.

// Screen reader only content
.offscreen {
// code taken from orange's fork of bootstrap
// https://github.com/Orange-OpenSource/Orange-Boosted-Bootstrap/blob/v5.1.3/scss/mixins/_visually-hidden.scss#L8
.offscreen,
.offscreen-focusable:not(:focus) {
position: absolute;
left: -10000px;
top: auto;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;

// Screen reader toggleable function, including offscreen navigation
&:active,
&:focus {
left: 5px;
top: 5px;
width: auto;
height: auto;
overflow: auto;
}
clip: rect(0, 0, 0, 0);
clip-path: inset(50%);
white-space: nowrap;
border: 0;
}

// Skip to content button styles for it to be rendered on link focus
Expand All @@ -28,6 +25,9 @@
background-color: r-color('midnightblue');
padding: 1rem;
z-index: 100000;
position: absolute;
jbpenrath marked this conversation as resolved.
Show resolved Hide resolved
left: 5px;
top: 5px;

&:active,
&:hover,
Expand Down
2 changes: 1 addition & 1 deletion src/richie/apps/core/templates/richie/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

{# First link on a website should always be a skip to content #}
{# Access key directive allows users to use keyboard shortcuts #}
<a href="#site-content" class="offscreen skip-to-content" accesskey="c">{% trans "Skip to main content" %}</a>
<a href="#site-content" class="offscreen-focusable skip-to-content" accesskey="c">{% trans "Skip to main content" %}</a>

{% block body_header %}

Expand Down