Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
26 changes: 26 additions & 0 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@ 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
}

// Gatsby renders the Head export inside an <svg> to avoid React 19 metadata hoisting, so the
// <title>/<meta> nodes it copies into <head> are created in the SVG namespace. Browsers and
// assistive technology ignore an SVG <title> for document.title, so recreate them as HTML elements.
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
Expand Down
6 changes: 3 additions & 3 deletions src/components/nav-drawer.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
display: flex;
flex-direction: column;
height: 100%;
background: #333333;
background: var(--bgColor-default, #ffffff);
overflow: auto;
}

.Box_3 {
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 {
Expand Down
9 changes: 9 additions & 0 deletions src/components/search.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@
flex-direction: column;
}

/* Primer's ThemeProvider wraps LightTheme content in a <div data-color-mode>. Let that wrapper
shrink to the remaining height so the results list scrolls instead of overflowing the viewport. */
.Box_6 > [data-color-mode] {
display: flex;
flex-direction: column;
flex: 1 1 auto;
min-height: 0;
}

.Box_7 {
display: flex;
color: #1f2328;
Expand Down
4 changes: 3 additions & 1 deletion src/components/variant-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ const StyledOverlay = styled(ActionMenu.Overlay)`
const VariantItem = ({title, shortName, url, active}) => {
return (
<ActionList.Item state={{scrollUpdate: false}} id={shortName} active={active} tabIndex={null}>
<LinkNoUnderline to={url}>{title}</LinkNoUnderline>
<LinkNoUnderline to={url} className={styles.variantLink}>
{title}
</LinkNoUnderline>
</ActionList.Item>
)
}
Expand Down
4 changes: 4 additions & 0 deletions src/components/variant-select.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
width: 100%;
}

a.variantLink {
color: var(--fgColor-default, #1f2328);
}

.menuButton:focus-visible {
outline: 2px solid;
outline-color: -webkit-focus-ring-color;
Expand Down
Loading