Skip to content

v3.0.0

Choose a tag to compare

@stamat stamat released this 05 Aug 19:48
· 27 commits to main since this release

Added

  • <kbd> is styled in prose. Nothing painted it before, so a key name rendered as
    body text and read as the word beside it. It takes the inline-code sizing — --bg-alt
    fill, --font-mono, 0.8em, nowrap so a key never wraps mid-name — plus a cap edge:
    a 1px border and a 0 2px 0 shadow under it, both from --kbd-edge. That is a local
    mix of --fg into --border, which darkens on light and lightens on dark; a fixed
    color would have vanished into one theme or the other. A chord nests per the spec —
    <kbd><kbd>Ctrl</kbd> + <kbd>C</kbd></kbd> — where the outer element groups rather than
    names a key, so :has(kbd) takes the cap off it and leaves the inner two.

    CSS: the selector is .prose kbd. --kbd-edge is declared on that rule rather than
    on :root, same as --adm on admonitions, so a site retuning the edge sets it in its
    own .prose kbd block — setting it higher up will not reach.

Changed

  • The copy button on a code block is <copy-elemental> now. The one the theme drew
    itself did the visible half and none of the other. It swapped an icon to a tick and told a
    screen reader nothing at all, which is
    WCAG 2.2 SC 4.1.3 Status Messages
    unmet — and a clipboard write that failed swapped nothing, so a refused copy and a button
    nobody pressed looked exactly alike. Both halves are what the element exists for, so the
    theme takes it rather than growing a live region of its own. book-of-elementals is
    ^0.5.0
    (was ^0.4.0), which is the release the element arrived in.

    What a reader gets: the tick is said out loud as well as drawn; a failed copy is red
    and says Copy failed in the same corner tooltip the success uses; and on a page served
    over plain http, where navigator.clipboard does not exist to be asked, there is no
    button rather than one that quietly does nothing. What lands on the clipboard is also
    trimmed now — leading newlines and trailing whitespace, so a pasted block does not run its
    last command on arrival, and indentation is left alone.

    DOM this changes: the .code-wrap around each .prose pre stays. Inside it the
    button is now
    <copy-elemental for="…"><button data-tip data-tip-error></button></copy-elemental>, plus
    the <span role="status"> the element appends for the announcement. The button has lost
    its .copy-btn class and its two inline <svg>s — the icon is a CSS mask. A <pre> with
    no id is given code-block-N, since for is how the element finds what to copy; an id
    the page already uses is stepped over rather than taken.

    CSS this changes: every .copy-btn rule is gone, and a site overriding one is
    overriding nothing. The button is copy-elemental > button, its states are
    copy-elemental[data-state="copied"] and [data-state="error"], and the stand-down inside
    a live sample is code-preview copy-elemental { display: none }. The look is the element's
    own theme with four properties re-pointed: --copy-elemental-surface to --bg,
    --copy-elemental-border-color to --border, --copy-elemental-hover to --bg-alt,
    --copy-elemental-icon-size to 1rem. Canvas is what the first of those had been —
    the UA's page colour, which is a shade off this theme's own on a dark page.

  • The sidebar drawer inherits 0.5's <disclosure-elemental> fixes. Its region — which
    here is #sidebar-nav — is now display: flow-root, so a region whose first or last child
    carries a margin no longer slides open past where it sits and snaps back, and it carries
    data-state="open" / "closed" alongside hidden. Nothing in this theme moves: the rail's
    inset is on .sidebar > .nav and nothing in there was collapsing a margin out through the
    edge. A site that gave the region a display of its own still wins — the rule is one
    class — but one leaning on a child margin escaping it has that to put back.

Fixed

  • Tapping the search field no longer zooms iOS into the topbar. Safari zooms the page
    whenever a field under 16px takes focus, and it does not zoom back out when the field is
    blurred — so one tap on search left the reader scrolled sideways through a magnified page
    with no way back but a pinch. #search-input was 0.9rem, which is 14.4px at the default
    root size. It is max(16px, 1em) now: 16px is Safari's threshold verbatim, so it holds even
    for a reader whose root size is smaller, which a plain rem would follow straight back under
    it; the 1em arm lets a scaled topbar carry the field up.

    It is not a phone-only bug and it is not gated behind a media query, because the two queries
    that look like they would scope it both miss the same device: an iPad with a trackpad
    attached clears the 40rem breakpoint and reports pointer: fine, and its screen still
    gets tapped. A site retuning the field wants a floor of its own, not a bare font-size.

Changed

  • Code blocks carry the same 16px floor as the search field. .prose pre was 0.85rem
    — 13.6px on a default root, small enough on a phone that reading a snippet meant pinching,
    and pinching a block that scrolls sideways zooms the page instead. It is max(16px, 1em)
    now: body size in an ordinary article, and never under the size iOS zooms below. That
    second half is not only about legibility — a code-preview pane can make a block editable,
    and an editable block is a field Safari will zoom into on focus like any other.
    The extra width goes to the overflow-x the block already had.

    Inline code and <kbd> are unchanged: both are sized in em, so they follow whatever text
    they sit in rather than the root, and neither can take focus.

    CSS: the selector is .prose pre. A site that wants the old density should keep a floor
    rather than replace the declaration outright — a bare font-size: 0.85rem there puts an
    editable preview back under the threshold.

Full Changelog: v2.0.0...v3.0.0