-
Notifications
You must be signed in to change notification settings - Fork 59
feat(docs): update navigation components for improved accessibility and structure #3517
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
base: ouds/main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,32 +1,27 @@ | ||||||
| --- | ||||||
| import { getVersionedDocsPath } from '@libs/path' | ||||||
|
|
||||||
| const slug = Astro.url.pathname.split('/')[4] | ||||||
|
|
||||||
| const sidebarMap = { | ||||||
| 'getting-started': 'Getting started', | ||||||
| foundation: 'Foundation', | ||||||
| components: 'Components', | ||||||
| utilities: 'Utilities', | ||||||
| layout: 'Layout' | ||||||
| } | ||||||
| --- | ||||||
|
|
||||||
| <!--OUDS mod: doesn’t exist anymore in Bootstrap--> | ||||||
| <nav class="bd-subnavbar py-small d-lg-none" aria-label="Secondary navigation"> | ||||||
| <div class="container-fluid container-max-width d-flex justify-content-end"> | ||||||
| <button | ||||||
| class="btn btn-default btn-icon" | ||||||
| type="button" | ||||||
| data-bs-toggle="offcanvas" | ||||||
| data-bs-target="#bdSidebar" | ||||||
| aria-controls="bdSidebar" | ||||||
| aria-label="Toggle docs navigation" | ||||||
| > | ||||||
| <svg | ||||||
| xmlns="http://www.w3.org/2000/svg" | ||||||
| width="24" | ||||||
| height="24" | ||||||
| class="bi" | ||||||
| fill="currentColor" | ||||||
| viewBox="0 0 16 16" | ||||||
| aria-hidden="true" | ||||||
| > | ||||||
| <path | ||||||
| fill-rule="evenodd" | ||||||
| d="M1 8a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13A.5.5 0 0 1 1 8zM7.646.146a.5.5 0 0 1 .708 0l2 2a.5.5 0 0 1-.708.708L8.5 1.707V5.5a.5.5 0 0 1-1 0V1.707L6.354 2.854a.5.5 0 1 1-.708-.708l2-2zM8 10a.5.5 0 0 1 .5.5v3.793l1.146-1.147a.5.5 0 0 1 .708.708l-2 2a.5.5 0 0 1-.708 0l-2-2a.5.5 0 0 1 .708-.708L7.5 14.293V10.5A.5.5 0 0 1 8 10z" | ||||||
| ></path> | ||||||
| </svg> | ||||||
| <div class="container-fluid container-max-width d-flex justify-content-start"> | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To discuss, but I'd have kept the button on the right I think
Suggested change
|
||||||
| <button class="btn btn-default" type="button" data-bs-toggle="offcanvas" | ||||||
| data-bs-target="#bdSidebar" aria-controls="bdSidebar"> | ||||||
| <svg aria-hidden="true"> | ||||||
| <use xlink:href={`${getVersionedDocsPath('/assets/img/ouds-web-sprite.svg#outgoing')}`}></use> | ||||||
| </svg> | ||||||
| <span class="d-none d-sm-inline">Browse docs: {sidebarMap[slug]}</span> | ||||||
| <span class="d-sm-none">Browse docs</span><span class="visually-hidden">{sidebarMap[slug]}</span> | ||||||
|
||||||
| <span class="d-sm-none">Browse docs</span><span class="visually-hidden">{sidebarMap[slug]}</span> | |
| <span class="d-sm-none">Browse docs</span><span class="visually-hidden">: {sidebarMap[slug]}</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe Browse [slug] would be better here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sidebarMap[slug]only covers a subset of top-level docs sections, so on pages like/about/*or other slugs not listed, the UI will renderBrowse docs:with an empty section label (and the visually-hidden label will also be empty). Consider adding the missing sections (e.g.about) and/or providing a fallback label + conditional rendering of the colon only when a section title is available.