fix(a11y): add a skip link, demote the subtitle, and size the sort arrow
a11y.30: `<main id="main-content">` existed and nothing linked to it, so a keyboard user walked the library filter, the search box, the job indicator and eleven nav items before reaching content, on every navigation. Two things in it are load-bearing and only checkable against the running document: the link is out of flow in *both* states, because `body` is a grid with named areas and an in-flow extra child is auto-placed into one of them; and `<main>` needs tabindex="-1", or the fragment link moves the scroll, leaves the tab sequence where it was, and looks like it worked. a11y.29: `<h1>` followed by `<h3>` for type size. An `hgroup` takes one heading plus paragraphs, so a `<p>` is also what it was meant to hold. a11y.34: the sort arrow was 10px, below the type scale's own floor, with a comment acknowledging it. Half of that finding was closed by Phase 1 — the direction is announced now, via aria-sort — and the other half is one declaration. And the state that landed in: the hgroup measured 67px inside a 64px bar, so dropping the h3's bottom margin shortened the block, moved the flex-centred pair down, and clipped the subtitle's descenders. The overflow was pre-existing; `margin-block: 0` on the title is the fix, pinned by a new layout-overflow case.
This commit is contained in:
@@ -135,3 +135,26 @@ test.describe('the app fits in its own window', () => {
|
||||
expect(reachable).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('the title block fits its bar', () => {
|
||||
test('the hgroup stays inside the 4em top bar', async ({ app }) => {
|
||||
// The state a11y.29 landed in. The pair is flex-centred and a UA
|
||||
// gives an `h1` a 0.67em top margin, so the block measured 67px
|
||||
// inside 64 — pre-existing, and invisible until dropping the h3's
|
||||
// bottom margin shortened the block and shifted it down into the
|
||||
// clip. The descenders of "meant to bee." were cut.
|
||||
const fits = await app.locator('hgroup').evaluate((el) => {
|
||||
const bar = el.closest('.top-bar')!.getBoundingClientRect();
|
||||
const group = el.getBoundingClientRect();
|
||||
|
||||
return {
|
||||
top: group.top >= Math.floor(bar.top),
|
||||
bottom: group.bottom <= Math.ceil(bar.bottom),
|
||||
height: Math.round(group.height),
|
||||
};
|
||||
});
|
||||
|
||||
expect(fits.top).toBe(true);
|
||||
expect(fits.bottom).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user