diff --git a/src/components/Header/styles.ts b/src/components/Header/styles.ts index 6fe64c6..9c9d4bf 100644 --- a/src/components/Header/styles.ts +++ b/src/components/Header/styles.ts @@ -35,6 +35,18 @@ export const logoImageStyle = mergeStyles({ lineHeight: "1", }); +export const skipContentStyle = mergeStyles({ + left: "50%", + position: "absolute", + transform: "translateY(-250%)", + padding: "8px", + transition: "transform 0.3s", + + "&:focus": { + transform: "translateY(0%)", + }, +}); + export const headerPipeStyle = mergeStyles({ marginTop: "0px !important", marginLeft: "7px !important", diff --git a/src/pages/Docs/Docs.index.tsx b/src/pages/Docs/Docs.index.tsx index 3df1922..6faa53e 100644 --- a/src/pages/Docs/Docs.index.tsx +++ b/src/pages/Docs/Docs.index.tsx @@ -9,6 +9,7 @@ import DocsHtmlContent from "./components/DocsHtmlContent"; import Topic from "./components/Topic"; import { DATA_URL, SAS_URL, STAC_URL } from "../../utils/constants"; import ScrollToTop from "../../components/ScrollToTop"; +import { skipContentStyle } from "components/Header/styles"; const OpenApiSpec = React.lazy(() => import("./components/OpenApiSpec")); @@ -59,6 +60,15 @@ const Docs = () => { const documentationPane = (
+ { + const urlWithoutHash = window.location.href.split("#")[0]; + window.location.href = urlWithoutHash + "#generated-docs-content"; + }} + > + Skip to content + {tocComponent}
{breadcrumb} diff --git a/src/pages/Docs/components/DocsHtmlContent.tsx b/src/pages/Docs/components/DocsHtmlContent.tsx index dbcf073..5af1d92 100644 --- a/src/pages/Docs/components/DocsHtmlContent.tsx +++ b/src/pages/Docs/components/DocsHtmlContent.tsx @@ -9,12 +9,14 @@ import { a11yPostProcessDom } from "../../../utils"; interface DocsHtmlContentProps { className: string; markupJson: any; + idText?: string; } const DocsHtmlContent: React.FC = ({ className, markupJson, children, + idText, }) => { const navigate = useNavigate(); const contentRef = useRef(null); @@ -114,7 +116,7 @@ const DocsHtmlContent: React.FC = ({ : DOMPurify.sanitize(bodyWithRoutedLinks); const content = processedMarkup ? ( -
+
{children}
= ({ topics }) => { <>