Skip to content
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
1 change: 1 addition & 0 deletions assets/scss/_styles_project.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
@import "expand-content";
@import "docs-homepage";
@import "404";
@import "skip-links";

#print {
display: none; // Hide print functionality for now
Expand Down
118 changes: 72 additions & 46 deletions assets/scss/menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,43 +47,64 @@
opacity: 0;
}

&__mobile-trigger {
display: none;
}

&__mobile-icon {
&__mobile-btn {
position: fixed;
top: $header-first-nav-height-desktop;
left: 10px;
z-index: 34;
display: flex;
justify-content: center;
align-items: center;
width: 55px;
height: $header-second-nav-height;
left: 10px;
z-index: 34;
padding: 0;
background: transparent;
border: none;
transition: $transition;
cursor: pointer;

&:focus {
outline: 2px solid $color-shocking-pink;
outline-offset: 2px;
}

@include mq(large) {
display: none;
}
}

&__mobile-icon {
position: relative;
display: flex;
justify-content: center;
align-items: center;
width: 26px;
height: 22px;

&::before {
content: url("../img/burger.svg");
display: block;
width: 26px;
height: 22px;
}
}

&::after {
content: "";
&__mobile-btn[aria-expanded="true"] {
left: calc(100% - 55px);

.gd-docs-menu__mobile-icon::before {
display: none;
}

.gd-docs-menu__mobile-icon::after {
content: "";
display: block;
width: 31px;
height: 31px;
background-image: url("../img/close.svg");
background-repeat: no-repeat;
background-size: contain;
}

@include mq(large) {
display: none;
}
}

&__mobile-bg {
Expand All @@ -101,23 +122,11 @@
}
}

&__mobile-trigger:checked ~ &,
&__mobile-trigger:checked ~ &__mobile-bg {
&__mobile-btn[aria-expanded="true"] ~ &,
&__mobile-btn[aria-expanded="true"] ~ &__mobile-bg {
left: 0;
}

&__mobile-trigger:checked ~ &__mobile-icon {
left: calc(100% - 55px);

&::before {
display: none;
}

&::after {
display: block;
}
}

& > &-section {
padding-left: 0;
}
Expand All @@ -141,6 +150,14 @@
}
}

&-section-wrapper {
display: none;

&.expanded {
display: block;
}
}

&-page__label ~ &-section {
padding-left: 0;
}
Expand Down Expand Up @@ -193,25 +210,42 @@
}
}

&__toggle {
display: none;
}

&__chevron {
&__toggle-btn {
display: flex;
align-items: center;
justify-content: center;
margin: 4px 0 0;
padding: 4px;
background: transparent;
border: none;
cursor: pointer;

svg {

// Add focus styles for keyboard navigation
&:focus {
outline: 2px solid $color-shocking-pink;
outline-offset: 2px;
border-radius: 3px;
}

// SVG rotation based on expanded state
&[aria-expanded="false"] .gd-docs-menu-page__chevron svg {
transform: rotate(180deg);
}
}

&__toggle:checked ~ &__title &__chevron {
svg {

&[aria-expanded="true"] .gd-docs-menu-page__chevron svg {
transform: rotate(0deg);
}
}

&__chevron {
display: flex;
margin: 0;
}

&__toggle {
display: none;
}

&__label {
display: block;
flex: 0 0 auto;
Expand All @@ -223,14 +257,6 @@
}
}

&-page__toggle ~ &-section {
display: none;
}

&-page__toggle:checked ~ &-section {
display: block;
}

.dropdown-toggle {
display: flex;
justify-content: space-between;
Expand Down
66 changes: 66 additions & 0 deletions assets/scss/skip-links.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Skip links for accessibility
.skip-links {
position: absolute;
top: 0;
left: 0;
z-index: 1050; // Higher than other elements
}

.sidebar-skip-links {
display: flex;
flex-direction: column;
margin-bottom: 10px;
}

.skip-link {
position: absolute;
left: -10000px;
top: auto;
width: 1px;
height: 1px;
overflow: hidden;
background-color: #fff;
color: #000;
padding: 10px 15px;
font-weight: 600;
text-decoration: none;
border: 2px solid #000;
border-radius: 4px;
z-index: 1050;

&:focus {
position: static;
width: auto;
height: auto;
overflow: visible;
margin: 10px;
outline: 3px solid #2563eb; // Focus indicator
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.5);
}

// Variants
&--sidebar {
margin-bottom: 5px;

&:focus {
position: static;
width: 100%;
height: auto;
overflow: visible;
margin: 0 0 5px 0;
text-align: center;
}
}

&--footer {
&:focus {
position: static;
width: auto;
height: auto;
overflow: visible;
margin: 10px auto;
display: block;
text-align: center;
}
}
}
5 changes: 3 additions & 2 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
{{ partial "head.html" . }}
{{ partial "meta-version.html" . }}
</head>
<body class="td-{{ .Kind }}{{ if .Page.Params.edition }} doc{{ .Page.Params.edition }}{{ end }}{{ if .Page.Params.type }} {{ .Page.Params.type }}{{ end }}">
<body class="td-{{ .Kind }}{{ if .Page.Params.edition }} doc{{ .Page.Params.edition }}{{ end }}{{ if .Page.Params.type }} {{ .Page.Params.type }}{{ end }}" id="top">
{{ partial "gtm-body.html" }}
{{ partial "skip-links.html" . }}
<header>
{{ partial "navbar.html" . }}
</header>
Expand All @@ -21,7 +22,7 @@
</div>
<main class="
col-12 col-xl-8
" role="main">
" role="main" id="main-content">
{{ partial "version-banner.html" . }}
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
{{ if .Draft }}
Expand Down
5 changes: 3 additions & 2 deletions layouts/api-reference/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
{{ partial "head.html" . }}
{{ partial "meta-version.html" . }}
</head>
<body class="td-{{ .Kind }}{{ if .Page.Params.edition }} doc{{ .Page.Params.edition }}{{ end }}{{ if .Page.Params.type }} {{ .Page.Params.type }}{{ end }}">
<body class="td-{{ .Kind }}{{ if .Page.Params.edition }} doc{{ .Page.Params.edition }}{{ end }}{{ if .Page.Params.type }} {{ .Page.Params.type }}{{ end }}" id="top">
{{ partial "gtm-body.html" }}
{{ partial "skip-links.html" . }}
<header>
{{ partial "navbar.html" . }}
</header>
<div class="container-fluid td-default td-outer">
<main role="main" class="td-main">
<main role="main" class="td-main" id="main-content">
{{ block "main" . }}{{ end }}
</main>
{{ partialCached "footer.html" . }}
Expand Down
5 changes: 3 additions & 2 deletions layouts/docs/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
<meta http-equiv="refresh" content="0;url={{ .Params.externalLink }}" />
{{ end }}
</head>
<body class="td-{{ .Kind }}{{ if .Page.Params.edition }} doc{{ .Page.Params.edition }}{{ end }}{{ if .Page.Params.type }} {{ .Page.Params.type }}{{ end }}">
<body class="td-{{ .Kind }}{{ if .Page.Params.edition }} doc{{ .Page.Params.edition }}{{ end }}{{ if .Page.Params.type }} {{ .Page.Params.type }}{{ end }}" id="top">
{{ partial "gtm-body.html" }}
{{ partial "skip-links.html" . }}
<header>
{{ partial "navbar.html" . }}
</header>
Expand All @@ -25,7 +26,7 @@
<div class="d-none d-xl-block col-xl-2 td-toc d-print-none">
{{ partial "toc.html" . }}
</div>
<main class="col-12 col-lg-8 col-xl-7 pl-lg-5 ps-lg-5" role="main">
<main class="col-12 col-lg-8 col-xl-7 pl-lg-5 ps-lg-5" role="main" id="main-content">
{{ partial "version-banner.html" . }}
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
{{ if .Draft }}
Expand Down
2 changes: 2 additions & 0 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
{{ $footer := getJSON "https://www.gooddata.com/learn-assets/js/footer-definition.json" }}

<footer class="gd-footer">
<a href="#top" class="skip-link skip-link--footer">Skip footer content</a>

{{ if $footer.footer.bannerLinks }}
<ul class="gd-footer-banner-links gd-footer-links">
{{ range $index, $link := $footer.footer.bannerLinks }}
Expand Down
37 changes: 26 additions & 11 deletions layouts/partials/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{{/* (C) 2023 GoodData Corporation */}}
<input type="checkbox" id="gd-docs-menu__mobile-trigger" class="gd-docs-menu__mobile-trigger" />
<label for="gd-docs-menu__mobile-trigger" class="gd-docs-menu__mobile-icon"></label>
<button type="button" id="gd-docs-menu__mobile-trigger" class="gd-docs-menu__mobile-btn" aria-expanded="false" aria-controls="gd-docs-menu" aria-label="Toggle navigation menu">
<span class="gd-docs-menu__mobile-icon" aria-hidden="true"></span>
</button>
<div class="gd-docs-menu__mobile-bg"></div>
<nav class="gd-docs-menu init">
<nav id="gd-docs-menu" class="gd-docs-menu init">
<div class="sidebar-skip-links">
<a href="#main-content" class="skip-link skip-link--sidebar">Skip to main content</a>
</div>

{{ if .Site.Params.versions }}
{{ partial "navbar-version-selector.html" . }}
{{ end }}
Expand Down Expand Up @@ -47,10 +52,6 @@
{{ if $page.Params.navigationLabel }}
<span class="gd-docs-menu-page__label">{{ $page.LinkTitle }}</span>
{{ else }}
{{ if $page.Pages }}
<input type="checkbox" id="gd-docs-menu-page__{{ $pageId }}" class="gd-docs-menu-page__toggle"{{ if $activeSection }} checked{{ end }} />
{{ end }}

<div class="gd-docs-menu-page__title">
{{ if $page.Params.externalLink }}
<a href="{{ $page.Params.externalLink }}" class="gd-docs-menu-page__link" target="_blank">{{ $page.LinkTitle }}</a>
Expand All @@ -59,15 +60,29 @@
{{ end }}

{{ if $page.Pages }}
<label for="gd-docs-menu-page__{{ $pageId }}" class="gd-docs-menu-page__chevron">
{{ with resources.Get "icons/chevron-menu.svg" }}{{ ( . | minify).Content | safeHTML }}{{ end }}
</label>
<button
type="button"
id="btn-{{ $pageId }}"
class="gd-docs-menu-page__toggle-btn"
aria-expanded="{{ if $activeSection }}true{{ else }}false{{ end }}"
aria-controls="section-{{ $pageId }}"
aria-label="{{ if $activeSection }}Collapse{{ else }}Expand{{ end }} {{ $page.LinkTitle }} section">
<span class="gd-docs-menu-page__chevron">
{{ with resources.Get "icons/chevron-menu.svg" }}
{{ $svg := . | minify }}
{{ $svg := replace $svg.Content "<svg " "<svg aria-hidden=\"true\" focusable=\"false\" " }}
{{ $svg | safeHTML }}
{{ end }}
</span>
</button>
{{ end }}
</div>
{{ end }}

{{ if $page.Pages }}
{{ template "section-tree-nav-sections" (dict "root" $page.Pages "currentPage" $currentPage "activeSection" $activeSection "site" $site) }}
<div id="section-{{ $pageId }}" class="gd-docs-menu-section-wrapper{{ if $activeSection }} expanded{{ end }}">
{{ template "section-tree-nav-sections" (dict "root" $page.Pages "currentPage" $currentPage "activeSection" $activeSection "site" $site) }}
</div>
{{ end }}
</li>
{{ end }}
Expand Down
Loading