From e54f927149da9e2f6aebb7701f2f9ece9c4046db Mon Sep 17 00:00:00 2001 From: diondiondion Date: Thu, 21 May 2026 15:41:14 +0200 Subject: [PATCH] Accessibility: Add skip link & landmark regions to settings (#39129) --- app/javascript/styles/mastodon/admin.scss | 27 +++++++++++++++++++++++ app/views/layouts/admin.html.haml | 5 +++-- config/locales/en.yml | 1 + 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/app/javascript/styles/mastodon/admin.scss b/app/javascript/styles/mastodon/admin.scss index 5ad9576b8f3..887f14360a1 100644 --- a/app/javascript/styles/mastodon/admin.scss +++ b/app/javascript/styles/mastodon/admin.scss @@ -136,6 +136,11 @@ $content-width: 840px; transition: all 100ms linear; transition-property: color, background-color; } + + &:focus-visible { + outline: var(--outline-focus-default); + outline-offset: -2px; + } } ul { @@ -1887,6 +1892,28 @@ a.sparkline { } } +.navigation-skip-link { + position: fixed; + z-index: 100; + margin: 10px; + padding: 10px 16px; + border-radius: 10px; + font-size: 15px; + color: var(--color-text-primary); + background: var(--color-bg-primary); + box-shadow: var(--dropdown-shadow); + + /* Hide visually when not focused */ + &:not(:focus-within) { + width: 1px; + height: 1px; + margin: 0; + padding: 0; + clip-path: inset(50%); + overflow: hidden; + } +} + .section-skip-link { float: right; diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 6e49ed90339..039ca88f7e3 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -6,8 +6,9 @@ - content_for :body_classes, 'admin' - content_for :content do + %a.navigation-skip-link{ href: '#content' }= t('admin.skip_to_content') .admin-wrapper - .sidebar-wrapper + %nav.sidebar-wrapper .sidebar-wrapper__inner .sidebar = link_to root_path do @@ -24,7 +25,7 @@ = render_navigation - .content-wrapper + %main.content-wrapper#content .content .content__heading - if content_for?(:heading) diff --git a/config/locales/en.yml b/config/locales/en.yml index 41c80e39d09..2ed8dd1c1a7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -979,6 +979,7 @@ en: site_uploads: delete: Delete uploaded file destroyed_msg: Site upload successfully deleted! + skip_to_content: Skip to content software_updates: critical_update: Critical — please update quickly description: It is recommended to keep your Mastodon installation up to date to benefit from the latest fixes and features. Moreover, it is sometimes critical to update Mastodon in a timely manner to avoid security issues. For these reasons, Mastodon checks for updates every 30 minutes, and will notify you according to your email notification preferences.