diff --git a/gatsby-browser.js b/gatsby-browser.js index 12118ae9a49..959715647e3 100644 --- a/gatsby-browser.js +++ b/gatsby-browser.js @@ -3,6 +3,29 @@ import {SKIP_TO_SEARCH_ID} from './src/constants' export {default as wrapPageElement} from './src/page' export {default as wrapRootElement} from './src/root' +const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml' + +const toHtmlNamespace = node => { + const element = document.createElement(node.nodeName.toLowerCase()) + for (const {name, value} of node.attributes) { + element.setAttribute(name, value) + } + element.textContent = node.textContent + return element +} + +const fixHeadNamespaces = () => { + for (const node of document.head.querySelectorAll('[data-gatsby-head]')) { + if (node.namespaceURI !== HTML_NAMESPACE) { + node.replaceWith(toHtmlNamespace(node)) + } + } +} + +export const onClientEntry = () => { + new MutationObserver(fixHeadNamespaces).observe(document.head, {childList: true}) +} + export const shouldUpdateScroll = ({routerProps}) => { const {scrollUpdate = true} = routerProps.location.state ?? {} return scrollUpdate diff --git a/src/components/nav-drawer.module.css b/src/components/nav-drawer.module.css index 0a3546212bc..5af65a3edca 100644 --- a/src/components/nav-drawer.module.css +++ b/src/components/nav-drawer.module.css @@ -19,7 +19,7 @@ display: flex; flex-direction: column; height: 100%; - background: #333333; + background: var(--bgColor-default, #ffffff); overflow: auto; } @@ -27,8 +27,8 @@ display: flex; flex-direction: column; flex: 1 0 auto; - color: #e1e4e8; - background: #333333; + color: var(--fgColor-default, #1f2328); + background: var(--bgColor-default, #ffffff); } .Box_4 { diff --git a/src/components/nav-items.js b/src/components/nav-items.js index f3c0cf0f8b6..d6fba0979e2 100644 --- a/src/components/nav-items.js +++ b/src/components/nav-items.js @@ -10,9 +10,10 @@ import useSiteMetadata from '../hooks/use-site-metadata' import * as styles from './nav-items.module.css' -const NavItem = ({item, path, depth}) => { +const NavItem = ({item, path, depth, position, total}) => { const isCurrent = getNav.isActiveUrl(path, item.url) const items = getNav.getHierarchy(item, item.url, {hideVariants: true}) + const positionLabel = items ? {} : {'aria-label': `${item.title}, ${position} of ${total}`, 'aria-labelledby': null} return ( { to={item.url} defaultOpen={items && isCurrent} aria-current={isCurrent ? 'page' : null} + {...positionLabel} className={depth === 1 ? styles.NavList_Item_depth1 : styles.NavList_Item_depth2} > {item.title} @@ -34,11 +36,11 @@ const NavItem = ({item, path, depth}) => { const NavItems = ({items, path, depth = 1}) => ( <> - {items.map(item => + {items.map((item, index) => React.createElement( depth === 1 ? NavList.Group : React.Fragment, {key: item.title}, - , + , ), )} diff --git a/src/components/search.module.css b/src/components/search.module.css index d9f834097f1..b6abf39f2e8 100644 --- a/src/components/search.module.css +++ b/src/components/search.module.css @@ -42,6 +42,13 @@ flex-direction: column; } +.Box_6 > [data-color-mode] { + display: flex; + flex-direction: column; + flex: 1 1 auto; + min-height: 0; +} + .Box_7 { display: flex; color: #1f2328; diff --git a/src/components/table-of-contents.js b/src/components/table-of-contents.js index e5d20b6f6c6..0f45399b5e1 100644 --- a/src/components/table-of-contents.js +++ b/src/components/table-of-contents.js @@ -48,7 +48,7 @@ export const Mobile = withTableOfContents(({items}) => {