Slab
Slab

What's new

0.3.0

Values screenreaders read the way you mean them, headings in Disclosure, dialogs in Popover, and the rest of the accessibility audit.

0.3.0 finishes the accessibility audit 0.2.0 began. Sliders, meters and ratings can say what their numbers mean, Disclosure and Popover take the roles they're used for, and Calendar, File Drop and Command Palette say what just happened. It's a minor release because Splitter's separator moved its focus, so check how you style it.

TL;DR The short version

  1. Slider, Range Slider, Meter, Progress and Rating take formatValue, so a screenreader reads "$40" or "3 of 5 GB" rather than a bare number.
  2. Disclosure's label can be a heading, and a Popover with a label is a dialog.
  3. Calendar ranges, File Drop and Command Palette tell screenreaders what just happened.
  4. Splitter's separator is a native range input inside, so phone screenreaders move it with a swipe.
  5. Splitter's focus ring moves to a focus-visible part.

New features

  • Values that read right

    formatValue, a function of the value whose result screenreaders read, such as "$40" or "3 stars", in Slider, Range Slider, Meter, Progress and Rating.

  • Disclosure headings

    heading-level puts Disclosure's label in a heading of that level, as the APG's accordion does, so it's in a screenreader's list of headings.

  • Popover dialogs

    With label, a Popover is a non-modal dialog named by it, for one that holds a form or controls rather than a few words.

Fixes

The last of the accessibility audit, and two parts back in the manifest. A line each, and the components it's in.

Screenreaders

  • A range's first day, and then the whole range, are announced as they're picked.

  • A drop says how many files were added, and how many were left out.

  • How many results are left is announced once typing pauses, as in Combobox.

Touch and target size

  • The separator is a native range input, so phone screenreaders move it with a swipe.

  • The styled box is 24 pixels square, WCAG 2.5.8's smallest target.

Editors and docs

Before you upgrade

One change can break what you have. It's why this is a minor release.

  • Splitter's focus ring

    The separator holds a hidden range input that takes focus, so it isn't [role=separator] and doesn't match :focus-visible. Style its ring through the focus-visible part.

    Before
    slab-splitter::part(separator):focus-visible {
      outline: 3px solid;
    }
    After
    slab-splitter::part(separator focus-visible) {
      outline: 3px solid;
    }

Upgrade

Install
pnpm add slab-elements@0.3.0

Every change, in full, is in the release notes.