Revert "fix(ui): draw hub page links as S2's Tabs"

This reverts commit 0bde8441f9.
This commit is contained in:
Zakk committed 2026-10-31 13:33:45 +00:00
1 parent 6da917f62b
commit c1eaff08eb
8 files changed
+13 -81

No files matched your search

-3
View File
@@ -1,3 +0,0 @@
Fixed
- A hub's page links on a narrow screen are drawn as S2's Tabs: plain labels 24px apart, hover changing only the text colour, and the current page marked by a rounded 2px line as wide as its label. The labels can no longer be selected by dragging or clicking.
+2 -9
View File
@@ -47,19 +47,12 @@ for (const width of [1280, 1024, 390, 320]) {
}
if (width <= 390) {
const undersized = await page.locator('.rp-top .rp-btn.icon, .rp-hubbar > a, .rp-hubnav .rp-page-link, .rp-content .rp-tab').evaluateAll(elements =>
const undersized = await page.locator('.rp-top .rp-btn.icon, .rp-hubbar > a, .rp-hubnav .rp-btn, .rp-content .rp-tab').evaluateAll(elements =>
elements
.filter(element => element.getClientRects().length)
.map(element => {
const box = element.getBoundingClientRect();
// A page link's invisible ::before extends its hit area on a touch screen.
const area = getComputedStyle(element, '::before');
const out = (side: 'top' | 'right' | 'bottom' | 'left') => (area.content === 'none' ? 0 : Math.max(0, -parseFloat(area[side]) || 0));
return {
label: element.getAttribute('aria-label') ?? element.textContent,
width: box.width + out('left') + out('right'),
height: box.height + out('top') + out('bottom')
};
return {label: element.getAttribute('aria-label') ?? element.textContent, width: box.width, height: box.height};
})
.filter(box => box.width < 36 || box.height < 36)
);
+1 -1
View File
@@ -434,7 +434,7 @@ test.describe('360px', () => {
for (const hub of hubs) {
for (const route of hub.pages) {
await page.goto(`/#/${route}`);
await expect(page.locator('.rp-hubnav .rp-page-link')).toHaveCount(hub.pages.length);
await expect(page.locator('.rp-hubnav .rp-btn')).toHaveCount(hub.pages.length);
const strip = () =>
page.locator('.rp-hubnav').evaluate(nav => {
const box = nav.getBoundingClientRect();
+2 -2
View File
@@ -81,7 +81,7 @@ test.describe('page rows on a phone', () => {
await page.evaluate(() => document.fonts.ready);
await settleFrames(page);
for (const scope of ['.rp-content .rp-page-links', '.rp-content [data-page-tabrow] .rp-tablist'])
expect(await lineCount(page, scope, '.rp-btn, .rp-page-link, [role=tab]'), `${route} ${scope}`).toBeLessThanOrEqual(1);
expect(await lineCount(page, scope, '.rp-btn, [role=tab]'), `${route} ${scope}`).toBeLessThanOrEqual(1);
}
await page.goto('/#/connections');
await page.locator('.rp-content [role=tab]:visible').nth(1).click();
@@ -136,7 +136,7 @@ async function toolbarGeometry(page: Page) {
const sizes = getComputedStyle(document.documentElement);
const mHeight = parseFloat(sizes.getPropertyValue('--rp-control'));
const lHeight = parseFloat(sizes.getPropertyValue('--rp-control-lg'));
const controls = '.rp-btn, .rp-page-link, .rp-input, .rp-selectbtn, .rp-select, .rp-seg, .rp-switch, .rp-tab, .rp-tabbar';
const controls = '.rp-btn, .rp-input, .rp-selectbtn, .rp-select, .rp-seg, .rp-switch, .rp-tab, .rp-tabbar';
return [...root.querySelectorAll<HTMLElement>(`${rows}, ${localRows}`)]
.filter(row => row.checkVisibility({visibilityProperty: true}))
.flatMap(row => {
+4 -5
View File
@@ -1,14 +1,13 @@
import {Link} from './Link';
// A hub's sibling pages, drawn as S2's Tabs at compact density: plain labels over a divider with the current page
// underlined, so the row reads as navigation between pages rather than as the page's own tabs, which are a segmented
// control.
// A hub's sibling pages, drawn as S2's Tabs: quiet labels over a divider with the current page underlined, so the row
// reads as navigation between pages rather than as the page's own tabs, which are a segmented control.
export function PageLinks({label, items}: {label: string; items: {id: string; href: string; label: string; current?: boolean}[]}) {
return (
<nav className="rp-page-links" aria-label={label}>
{items.map(item => (
<Link key={item.id} className="rp-page-link" href={item.href} aria-current={item.current ? 'page' : undefined}>
<span>{item.label}</span>
<Link key={item.id} appearance="button" quiet href={item.href} aria-current={item.current ? 'page' : undefined}>
{item.label}
</Link>
))}
</nav>
-1
View File
@@ -13,7 +13,6 @@
.rp-input .clear,
.rp-input .reveal,
.rp-link,
.rp-page-link,
.rp-tag-link,
.rp-tag-more,
.rp-disclosure-trigger,
-5
View File
@@ -491,11 +491,6 @@
padding: 0 var(--rp-space-2) env(safe-area-inset-bottom);
background: var(--rp-base);
}
/* The page links reach half a gap past their labels; the strip holds that reach, the row and its divider do not. */
.rp-hubnav {
margin-inline: calc(var(--rp-space-6) / -2);
padding-inline: calc(var(--rp-space-6) / 2);
}
@media (min-width: 1024px) {
.rp-hubnav,
.rp-hubbar {
+4 -55
View File
@@ -151,66 +151,15 @@
}
}
/* S2's Tabs at compact density: the label is the tab, M tall and 24px from the next; hover and press only darken the
text. The current tab's 2px indicator spans its label and sits on the row's divider. The link reaches half of each
gap, and on a touch screen a 44px height as an icon button does, so the label alone draws the focus ring. */
.rp-page-links {
display: flex;
flex-wrap: wrap;
column-gap: var(--rp-space-6);
gap: var(--rp-space-1);
border-block-end: 1px solid var(--rp-line);
}
.rp-page-link {
position: relative;
display: flex;
block-size: var(--rp-control);
padding-inline: calc(var(--rp-space-6) / 2);
margin-inline: calc(var(--rp-space-6) / -2);
color: var(--rp-subtle);
text-decoration: none;
white-space: nowrap;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
.rp-page-link > span {
position: relative;
display: flex;
align-items: center;
border-radius: var(--rp-r-sm);
}
.rp-page-link:is([data-hovered], [data-pressed], [aria-current='page']) {
color: var(--rp-text);
}
.rp-page-link:is(:focus-visible, [data-focus-visible]) {
outline: none;
}
.rp-page-link:is(:focus-visible, [data-focus-visible]) > span {
outline: var(--rp-focus-width) solid var(--rp-focus-color);
outline-offset: var(--rp-focus-offset);
}
.rp-page-link[aria-current='page'] > span::after {
content: '';
position: absolute;
inset: auto 0 0;
block-size: 2px;
border-radius: var(--rp-r-pill);
background: var(--rp-text);
}
@media (pointer: coarse) {
.rp-page-link::before {
content: '';
position: absolute;
inset: min(0px, 50% - 22px) 0;
}
}
@media (forced-colors: active) {
.rp-page-link[aria-current='page'] {
color: Highlight;
}
.rp-page-link[aria-current='page'] > span::after {
forced-color-adjust: none;
background: Highlight;
}
.rp-page-links [aria-current='page'] {
border-radius: 0;
box-shadow: inset 0 -2px var(--rp-text);
}
.rp-disclosure[data-variant='nav'] {
margin: 0;