Slab
Slab

What's new

0.2.0

Ten new components, from Command Palette to Feed, translations, and an accessibility pass over the rest.

0.2.0 brings ten new components, registerStrings() to translate what the elements say, and the fixes from an accessibility audit of every component. It's a minor release because Range Slider's and Color Picker's thumbs moved their focus, so check how you style it.

TL;DR The short version

  1. Ten new components, each headless, with its keyboard, ARIA and form support done.
  2. Checkbox and radio Menu Items, and Option Groups for Listbox, Select and Combobox.
  3. registerStrings() translates the words Slab's elements say on their own.
  4. Screenreaders now hear the labels, hints, errors and results they used to miss.
  5. Range Slider's and Color Picker's focus rings move to a focus-visible part.

New components

Every one is live below, styled the way this site styles them.

  • Schedule a pour Order ready-mix Assign a crew Strip the forms Log a cure test Send an invoice No commands match.

    Command Palette

    A Dialog with a search box and a list of commands. Typing filters them, and Enter runs the best match.

    Docs for Command Palette
  • Forms go up Thursday with Ana Ruiz
    Ana Ruiz
    Forms lead. 12 pours this month.
    Message Ana
    and her crew.

    Hover Card

    A preview of where a link goes, on hover and keyboard focus, with room for links of its own.

    Docs for Hover Card
  • Navigation Menu

    A site's navigation as the APG's disclosure navigation: buttons that show lists of links.

    Docs for Navigation Menu
  • Press Enter or type a comma. Try pasting "rebar, cure, slump".

    Tags Input

    A text input that turns what's typed or pasted into tags, each submitted as its own value.

    Docs for Tags Input
  • Click the name, type, and press Enter. Escape puts it back.

    Editable

    Text edited in place: a button that becomes an input. Enter commits and Escape discards.

    Docs for Editable
  • The crew needs at least one dry day in the window.

    Date Range Field

    Two native date inputs, each bounded by the other, that submit a start and an end.

    Docs for Date Range Field
  • pnpm add slab-elements

    Copy Button

    Copies value, or another element's text with from, and says so to screenreaders.

    Docs for Copy Button
  • At least 8 characters. Press Show password to check it.

    Password Field

    A password input with a toggle button that shows and hides what was typed.

    Docs for Password Field
  • Survey Lot staked Forms Rebar tied Pour Truck at 7am Cure Seven days

    Steps

    Where the user is in a checkout or a wizard, with Steps they can go back to when navigable.

    Docs for Steps
  • Pour finished

    38 cubic yards of 4,000 psi, placed from the northeast corner. See the ticket

    Feed

    Articles that load as the user scrolls, with Page Down and Page Up between them.

    Docs for Feed

Also new

  • Checkbox and radio Menu Items

    Menu Item takes type="checkbox" or type="radio", and the new Menu Group names a set of radios in a Menu or Context Menu.

  • Option Group

    Options under a heading in Listbox, Select and Combobox. The arrow keys and typeahead go across groups, and Combobox hides one that's filtered empty.

  • Translations

    registerStrings(), from slab-elements/strings.js, words what the elements say, such as "Dismiss" or "Next slide", for the nearest lang.

Accessibility, everywhere

From an accessibility audit of every component. A line each, and the components it's in.

Screenreaders

Keyboard

Motion, color and touch

  • Autoplay stops under reduced motion, and for good once focus moves in.

  • The colors to pick from stay in forced colors.

  • Thumbs are native range inputs, so phone screenreaders adjust them with a swipe.

Before you upgrade

2 changes can break what you have. They're why this is a minor release.

  • Range Slider's focus ring

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

    Before
    slab-range-slider::part(start):focus-visible {
      outline: 3px solid;
    }
    After
    slab-range-slider::part(start focus-visible) {
      outline: 3px solid;
    }
  • Color Picker's focus ring

    The same for the area, hue and alpha thumbs. The area has a second hidden input, for brightness, out of the tab order.

    Before
    slab-color-picker::part(hue-thumb):focus-visible {
      outline: 3px solid;
    }
    After
    slab-color-picker::part(hue-thumb focus-visible) {
      outline: 3px solid;
    }

Upgrade

Install
pnpm add slab-elements@0.2.0

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