explorer: Link the node name in breadcrumbs

The node name in the node, repo and user page breadcrumbs only opened
the node picker, and the node page was reachable only through a small
arrow inside it. Make the name a link to the node page and open the
picker from a separate, always visible chevron button. Escape returns
focus to the chevron, and the redundant "Open node view" arrows are
hidden where the link exists.

Breadcrumbs now use quieter slash separators, so the chevron no longer
sits next to another arrow, and every breadcrumb link underlines on
hover instead of turning brand blue.
This commit is contained in:
Brandon Oxendine
2026-11-13 11:32:10 +01:00
committed by Rūdolfs Ošiņš
parent c5957b32f4
commit 65e102b965
8 changed files with 198 additions and 73 deletions
+3 -1
View File
@@ -104,7 +104,9 @@
gap: 0.25rem;
}
.breadcrumb :global(a:hover) {
color: var(--color-text-brand);
text-decoration: underline;
text-decoration-thickness: 1px;
text-underline-offset: 2px;
}
.breadcrumb-current {
color: var(--color-text-secondary);
+146 -48
View File
@@ -33,6 +33,7 @@
import DropdownListItem from "@app/components/DropdownList/DropdownListItem.svelte";
import Icon from "@app/components/Icon.svelte";
import IconButton from "@app/components/IconButton.svelte";
import Link from "@app/components/Link.svelte";
import Popover from "@app/components/Popover.svelte";
import TextInput from "@app/components/TextInput.svelte";
@@ -47,9 +48,14 @@
// Where the picker sits. A breadcrumb sits on the left of the header, so
// its popover is anchored to the toggle's left edge instead of its right.
export let variant: "header" | "breadcrumb" | "panel" = "header";
// Splits the toggle: the hostname links to the node page, and a separate
// chevron opens the picker.
export let nodeLink = false;
const VALIDATION_TIMEOUT_MS = 10000;
let chevron: HTMLButtonElement | undefined = undefined;
// The httpd version of the seed serving the current page, if explorer no
// longer supports it. Only the node picker names that seed.
$: outdatedVersion =
@@ -226,6 +232,7 @@
function handleEscape(event: KeyboardEvent) {
if (expanded && event.key === "Escape") {
closeFocused();
chevron?.focus();
}
}
</script>
@@ -252,6 +259,35 @@
background-color: var(--color-surface-mid);
color: var(--color-text-primary);
}
.split {
display: flex;
align-items: center;
gap: 0.25rem;
padding-left: 0.5rem;
}
.node-link {
display: flex;
align-items: center;
gap: 0.375rem;
max-width: 14rem;
padding: 0.375rem 0;
color: var(--color-text-primary);
}
.chevron {
display: flex;
align-items: center;
background: transparent;
border: none;
padding: 0.25rem;
border-radius: var(--border-radius-sm);
color: var(--color-text-tertiary);
cursor: pointer;
}
.chevron:hover,
.chevron[aria-expanded="true"] {
background-color: var(--color-surface-mid);
color: var(--color-text-primary);
}
.hostname {
font: var(--txt-body-m-regular);
}
@@ -283,6 +319,22 @@
align-items: center;
gap: 0.125rem;
}
.hover-action {
display: flex;
opacity: 0;
}
/* Hover the whole dropdown row, not just .item, which sits inside the
row's padding. */
:global(:hover) > .item .hover-action,
:global(:focus-visible) > .item .hover-action,
.hover-action:focus-within {
opacity: 1;
}
@media (hover: none) {
.hover-action {
opacity: 1;
}
}
.add-new-row {
padding: 0.25rem 0.25rem 0 0.25rem;
}
@@ -325,35 +377,70 @@
popoverFullWidthOnMobile={variant === "breadcrumb"}
popoverPadding="0.25rem"
popoverBorderRadius="var(--border-radius-md)">
<div
slot="toggle"
let:toggle
class="target {variant}"
{title}
aria-label={ariaLabel}
on:click={toggle}
on:keydown={e => e.key === "Enter" && toggle()}
role="button"
tabindex="0"
aria-haspopup="dialog"
aria-expanded={expanded}>
<slot name="icon"><Icon name="seed" /></slot>
<div class="hostname txt-overflow">{baseUrl.hostname}</div>
{#await outdatedVersion then version}
{#if version !== undefined}
<span
class="failed-icon"
title="This node runs radicle-httpd {releaseNumber(
version,
)}, but explorer needs {minimumSupportedVersion} or newer. Upgrade radicle-httpd to the latest release.">
<Icon name="warning" />
</span>
{/if}
{/await}
{#if variant !== "breadcrumb"}
<Icon name={expanded ? "chevron-up" : "chevron-down"} />
<svelte:fragment slot="toggle" let:toggle>
{#if nodeLink}
<div class="split">
<Link
styleHoverState
route={{ resource: "nodes", params: { baseUrl, repoPageIndex: 0 } }}>
<span class="node-link">
<slot name="icon"><Icon name="seed" /></slot>
<span class="hostname txt-overflow">{baseUrl.hostname}</span>
</span>
</Link>
{#await outdatedVersion then version}
{#if version !== undefined}
<span
class="failed-icon"
title="This node runs radicle-httpd {releaseNumber(
version,
)}, but explorer needs {minimumSupportedVersion} or newer. Upgrade radicle-httpd to the latest release.">
<Icon name="warning" />
</span>
{/if}
{/await}
<button
bind:this={chevron}
type="button"
class="chevron"
{title}
aria-label="Switch node"
aria-haspopup="dialog"
aria-expanded={expanded}
on:click={toggle}>
<Icon name="chevron-down" />
</button>
</div>
{:else}
<div
class="target {variant}"
{title}
aria-label={ariaLabel}
on:click={toggle}
on:keydown={e => e.key === "Enter" && toggle()}
role="button"
tabindex="0"
aria-haspopup="dialog"
aria-expanded={expanded}>
<slot name="icon"><Icon name="seed" /></slot>
<div class="hostname txt-overflow">{baseUrl.hostname}</div>
{#await outdatedVersion then version}
{#if version !== undefined}
<span
class="failed-icon"
title="This node runs radicle-httpd {releaseNumber(
version,
)}, but explorer needs {minimumSupportedVersion} or newer. Upgrade radicle-httpd to the latest release.">
<Icon name="warning" />
</span>
{/if}
{/await}
{#if variant !== "breadcrumb"}
<Icon name={expanded ? "chevron-up" : "chevron-down"} />
{/if}
</div>
{/if}
</div>
</svelte:fragment>
<svelte:fragment slot="popover">
<div class="popover-content">
@@ -375,20 +462,27 @@
</span>
{/if}
<div class="actions">
<IconButton
ariaLabel="Open node view"
title="Open node view"
stopPropagation
on:click={() => openNodeView(item)}>
<Icon name="arrow-right" />
</IconButton>
{#if !nodeLink}
<span class="hover-action">
<IconButton
ariaLabel="Open node view"
title="Open node view"
stopPropagation
on:click={() => openNodeView(item)}>
<Icon name="arrow-right" />
</IconButton>
</span>
{/if}
{#if isBookmarked(item, $bookmarkedSeeds)}
<IconButton
ariaLabel="Remove bookmark"
stopPropagation
on:click={() => removeBookmark(item)}>
<Icon name="close" />
</IconButton>
<span class="hover-action">
<IconButton
ariaLabel="Remove bookmark"
title="Remove bookmark"
stopPropagation
on:click={() => removeBookmark(item)}>
<Icon name="close" />
</IconButton>
</span>
{:else}
<IconButton
ariaLabel="Bookmark seed"
@@ -447,13 +541,17 @@
<Icon name="warning" />
</span>
{/if}
<IconButton
ariaLabel="Open node view"
title="Open node view"
stopPropagation
on:click={() => openNodeView(item)}>
<Icon name="arrow-right" />
</IconButton>
{#if !nodeLink}
<span class="hover-action">
<IconButton
ariaLabel="Open node view"
title="Open node view"
stopPropagation
on:click={() => openNodeView(item)}>
<Icon name="arrow-right" />
</IconButton>
</span>
{/if}
</div>
</DropdownListItem>
</DropdownList>
+1 -1
View File
@@ -161,7 +161,7 @@
{baseUrl}
mode="node"
variant="breadcrumb"
ariaLabel="Current node selector"
nodeLink
title="Switch the node serving this page">
<svelte:fragment slot="icon">
<NodeAvatar nodeId={node.id} avatarUrl={node.avatarUrl} />
+5 -3
View File
@@ -99,13 +99,15 @@
gap: 0.375rem;
}
.node-crumb {
margin-right: -0.5rem;
margin-right: -0.25rem;
}
.repo-separator {
display: flex;
}
.breadcrumb :global(a:hover) {
color: var(--color-text-brand);
text-decoration: underline;
text-decoration-thickness: 1px;
text-underline-offset: 2px;
}
@media (max-width: 719.98px) {
.tab-bar {
@@ -191,7 +193,7 @@
{baseUrl}
mode="node"
variant="breadcrumb"
ariaLabel="Current node selector"
nodeLink
title="Switch the node serving this page">
<svelte:fragment slot="icon">
<NodeAvatar
+7 -3
View File
@@ -1,10 +1,14 @@
<script lang="ts">
import Icon from "@app/components/Icon.svelte";
</script>
<span
aria-hidden="true"
style:display="inline-flex"
style:align-items="center"
style:color="var(--color-text-tertiary)">
<Icon name="chevron-right" />
style:padding="0 0.25rem"
style:cursor="default"
style:user-select="none"
style:font="var(--txt-body-m-regular)"
style:color="var(--color-border-strong)">
/
</span>
+4 -2
View File
@@ -78,7 +78,9 @@
gap: 0.25rem;
}
.breadcrumb :global(a:hover) {
color: var(--color-text-brand);
text-decoration: underline;
text-decoration-thickness: 1px;
text-underline-offset: 2px;
}
</style>
@@ -90,7 +92,7 @@
{baseUrl}
mode="node"
variant="breadcrumb"
ariaLabel="Current node selector"
nodeLink
title="Switch the node serving this page">
<svelte:fragment slot="icon">
<NodeAvatar {nodeId} avatarUrl={nodeAvatarUrl} />
+31 -9
View File
@@ -187,14 +187,35 @@ test("node can be switched from a repo the node doesn't have", async ({
).toBeVisible();
});
test("repo page shows the node selector in the header", async ({ page }) => {
test("repo page links the node name and shows the node selector", async ({
page,
}) => {
await page.goto(`/nodes/localhost/${sourceBrowsingRid}`, {
waitUntil: "networkidle",
});
await expect(
page.getByRole("button", { name: "Current node selector" }),
).toContainText("localhost");
await expect(page.getByRole("link", { name: "localhost" })).toHaveAttribute(
"href",
"/nodes/localhost",
);
await expect(page.getByRole("button", { name: "Switch node" })).toBeVisible();
});
test("node selector works with the keyboard", async ({ page }) => {
await page.goto(`/nodes/localhost/${sourceBrowsingRid}`, {
waitUntil: "networkidle",
});
const chevron = page.getByRole("button", { name: "Switch node" });
await chevron.focus();
await page.keyboard.press("Enter");
await expect(chevron).toHaveAttribute("aria-expanded", "true");
await expect(page.getByText("Custom seeds")).toBeVisible();
await page.keyboard.press("Escape");
await expect(chevron).toHaveAttribute("aria-expanded", "false");
await expect(page.getByText("Custom seeds")).toBeHidden();
await expect(chevron).toBeFocused();
});
test("breadcrumb picker lists a seed that isn't bookmarked", async ({
@@ -220,18 +241,19 @@ test("breadcrumb picker lists a seed that isn't bookmarked", async ({
waitUntil: "networkidle",
});
const picker = page.getByRole("button", { name: "Current node selector" });
await expect(picker).toContainText("seed.example.tld");
await picker.click();
await page.getByRole("button", { name: "Switch node" }).click();
// The seed serving the page is listed under the custom seeds, even though
// it was never bookmarked, and its node view is reachable from there.
// it was never bookmarked.
const item = page
.locator(".item")
.filter({ hasText: "seed.example.tld" })
.first();
await expect(item).toBeVisible();
await item.getByRole("button", { name: "Open node view" }).click();
await expect(
item.getByRole("button", { name: "Open node view" }),
).toHaveCount(0);
await page.getByRole("link", { name: "seed.example.tld" }).click();
await expect(page).toHaveURL("/nodes/seed.example.tld");
});
+1 -6
View File
@@ -35,12 +35,7 @@ test("navigation between node and repo pages", async ({ page }) => {
await expectBackAndForwardNavigationWorks("/nodes/localhost", page);
await expectUrlPersistsReload(page);
// The node breadcrumb is a picker now, so the node page is reached through
// its "Open node view" action.
await page.getByRole("button", { name: "Current node selector" }).click();
await page
.getByRole("button", { name: "Open node view", exact: true })
.click();
await page.getByRole("link", { name: "localhost" }).click();
await expect(page).toHaveURL("/nodes/localhost");
});