Files
w3cjandClaude Opus 5.5 10c73195fa docs(site): install commands in a tab per operating system
The home page's quick start and Install devvm, and Installing's Installing devvm, show the install command in Hextra's tabs, from a new install shortcode: macOS with Homebrew, Linux with the install script. The macOS tab is selected in the HTML; a small partial selects the Linux tab for Linux visitors as the page loads. custom.css styles the tabs in the site's palette. README says which command is for which system, and Contributing describes the shortcode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:46:30 -07:00

23 lines
1.2 KiB
HTML

{{- /* Selects the Linux tab of the install shortcode around it for a Linux visitor, as the page loads, before
Hextra's tabs script runs. The browser's platform or its user agent string saying Linux is enough, so a
user agent set for a test (chrome --user-agent=…) selects it too. Android says Linux, but runs no devvm,
so it keeps macOS's tab. */ -}}
<script>
(() => {
const group = document.currentScript.parentElement;
const platform = [navigator.userAgentData?.platform, navigator.platform, navigator.userAgent].join(" ");
if (!/linux/i.test(platform) || /android/i.test(platform)) return;
const select = (elements, attribute, on, off) =>
elements.forEach((element, i) => {
const selected = i === 1;
element.dataset.state = selected ? "selected" : "";
element.setAttribute(attribute, selected ? on : off);
if (selected) element.tabIndex = 0;
else if (attribute === "aria-selected") element.tabIndex = -1;
else element.removeAttribute("tabindex");
});
select(group.querySelectorAll("[role=tab]"), "aria-selected", "true", "false");
select(group.querySelectorAll("[role=tabpanel]"), "aria-hidden", "false", "true");
})();
</script>