From c5cdfb1316154c3987bc692b030dfc53a654f6a4 Mon Sep 17 00:00:00 2001 From: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> Date: Sat, 22 Nov 2025 21:28:50 +0100 Subject: [PATCH] Made the language and documentation version switcher accessible by keyboard. --- djangoproject/scss/_style.scss | 130 +++++++++++++++++---------------- docs/templates/docs/doc.html | 24 ++---- 2 files changed, 77 insertions(+), 77 deletions(-) diff --git a/djangoproject/scss/_style.scss b/djangoproject/scss/_style.scss index 08a9a834fd..82aa1181bf 100644 --- a/djangoproject/scss/_style.scss +++ b/djangoproject/scss/_style.scss @@ -2286,88 +2286,96 @@ h2+.list-link-soup { z-index: 1; pointer-events: none; - list-style: none; - - .icon { - margin-right: 4px; - } + display: flex; + flex-direction: column; + align-items: flex-end; + gap: 0.6em; ul { text-align: right; + margin: 0; + padding: 0; + list-style: none; + display: inline-flex; + align-items: center; + justify-content: flex-end; + gap: 3px; } } -#doc-versions, -#doc-languages, -#faq-link, -#backtotop-link { - margin: 0; - padding-top: 0.25em; - padding-bottom: 0.25em; - - &.open { - li { - display: inline-block; +#doc-versions li, +#doc-languages li, +#faq-link li, +#backtotop-link li { + margin: 0 3px; + background: var(--body-bg); + border: 1px solid var(--hairline-color); + border-radius: 4px; + cursor: pointer; + pointer-events: auto; - &.current { - border: 1px solid $green-light; - } - } + a, + button { + display: inline-block; + background: var(--body-bg); + padding: 8px 15px; + border-radius: 4px; + border: none; + @include sans-serif; + font-size: 12px; + line-height: inherit; } - li { - display: none; - margin: 0 3px; - @include sans-serif; - color: var(--body-fg); - @include font-size(12); - pointer-events: auto; + a { + text-decoration: none; + font-weight: 700; + color: var(--primary); + } - &.current { - display: inline-block; - background: var(--body-bg); - padding: 8px 15px; - border: 1px solid var(--hairline-color); - border-radius: 4px; - cursor: pointer; + &:hover, + &:focus-within { + border-color: $green-light; + a { + color: var(--secondary); } + } +} - &.current-link { - display: inline-block; - } +#doc-languages, +#doc-versions { + position: relative; - a { - display: inline-block; - background: var(--body-bg); - color: var(--primary); - text-decoration: none; - font-weight: 700; - padding: 8px 15px; - border: 1px solid var(--hairline-color); - border-radius: 4px; + li { + display: inline-block; + padding: 0; + position: relative; - &:hover { - color: var(--secondary); - border: 1px solid $green-light; + &.current { + &::after { + content: ""; + position: absolute; + top: 0; + left: -8px; + width: 8px; + height: 100%; } } - a.icon-chevron-up-align { - // Should be removed when icon-chevron-up image have the same black space on both sides. - padding-right: 11px; + &.other { + display: none; + position: absolute; + right: 100%; + top: 0; + margin-right: 2px; + white-space: nowrap; + z-index: 2; } } - &:hover { - pointer-events: auto; - padding: 2em 0; - margin: -1.75em 0; - - li { - display: inline-block; - } + &:hover li.other, + &.open li.other { + display: inline-block; } - } #dev-warning, diff --git a/docs/templates/docs/doc.html b/docs/templates/docs/doc.html index 2373d2114a..69694a6d83 100644 --- a/docs/templates/docs/doc.html +++ b/docs/templates/docs/doc.html @@ -62,6 +62,9 @@