Skip to content

[3.0] Theme split (wave 3, part 3) — Use HTML landmark elements for the page chrome - #9371

Open
albertlast wants to merge 3 commits into
SimpleMachines:release-3.0from
albertlast:3.0/theme-landmarks
Open

[3.0] Theme split (wave 3, part 3) — Use HTML landmark elements for the page chrome#9371
albertlast wants to merge 3 commits into
SimpleMachines:release-3.0from
albertlast:3.0/theme-landmarks

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

Part 3 of wave 3 of the #7933 split. Stacked on #9370, which is stacked on #9369 — the diff of this one is its last commit.

The page chrome becomes HTML landmark elements: <header id="header">, <nav id="main_menu">, <main id="main_content_section"> and <footer id="footer">, in place of the divs that carried those ids before. Someone using a screen reader gets regions to jump between instead of one undifferentiated page.

This is the structural half of the header work, deliberately separated from the visual half. The theme branch does the reparenting and the restyling in the same change; splitting them means the part that moves boxes around can be reviewed on the evidence that it moves nothing.

Why nothing changes

Every rule for these four elements selects by id, so no selector in index.css, responsive.css, rtl.css or any script had to change. All four elements are block level by default, and the reset applies box-sizing, margin and padding through *, so they are already covered.

The other templates only ever reference #main_content_section as an anchor target for the "Go up" links, which still resolves.

Verification

Board index, a board and a topic, captured on the parent branch and again here, walking the whole DOM and recording for every element its tag, its getBoundingClientRect, and 24 computed properties covering colour, background, font, all four margins and paddings, border, radius, shadow, alignment, float and line height:

index: landmark elements 1 -> 5    116 elements, 0 style/geometry differences
board: landmark elements 2 -> 6    168 elements, 0 style/geometry differences
topic: landmark elements 2 -> 6    178 elements, 0 style/geometry differences

compared 13398 values across 3 pages
style/geometry differences: 0
element name changes (intended): 12

The twelve are the four intended elements on each of the three pages, and nothing else:

body/0/1:       DIV -> HEADER
body/0/2/0/0/2: DIV -> NAV
body/0/2/1/0:   DIV -> MAIN
body/1:         DIV -> FOOTER

Worth saying how the first attempt at this went wrong, since it is the same trap that bit #9333: I switched branches to capture the baseline while the edits were still uncommitted, so they came along, and both captures showed the new markup. The run above is from a committed tree, with the served HTML checked on each side before capturing.

Issues References (Fixes|Related|Closes)

Related to #7933.

The remaining theme parts are built on two nine-step ramps derived from a
single hue each, rather than on individually chosen colours. Adding them
ahead of those parts keeps each of them to the tokens it actually
introduces.

Nothing references the ramps yet and no existing token is repointed at
them, so this changes nothing that is rendered.

Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
The linktree becomes a nav landmark wrapping an ordered list, since the
trail is ordered, and carries schema.org BreadcrumbList microdata so a
search engine can read it. Layout moves from floats to flexbox, which
makes the two rtl.css rules for it redundant.

Keeps the HTML entity dividers rather than the icon font used on the
theme branch. Nothing in the default theme uses Font Awesome yet, and
the bundled local copy has no @font-face rule, so a forum with
fontawesome_source set to local would get no divider at all.

Keeps emitting the .last class as well, so anything styling it still
works, even though :last-child now covers it.

Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
The header, main menu, main content area and footer become header, nav,
main and footer instead of div. That gives assistive technology real
landmarks to navigate by, rather than a page that is one undifferentiated
region.

Every selector for these is by id, so nothing in the stylesheets or the
scripts has to change, and all four elements are block level already.

Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants