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.
- 10 new components
- 12 accessibility fixes
- 28 components fixed
- 2 changes to check
TL;DR The short version
- Ten new components, each headless, with its keyboard, ARIA and form support done.
- Checkbox and radio Menu Items, and Option Groups for Listbox, Select and Combobox.
registerStrings()translates the words Slab's elements say on their own.- Screenreaders now hear the labels, hints, errors and results they used to miss.
- Range Slider's and Color Picker's focus rings move to a
focus-visiblepart.
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 and her crew.Ana RuizMessage Ana
Forms lead. 12 pours this month.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
Docs for Copy Buttonvalue, or another element's text withfrom, and says so to screenreaders. -
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
Docs for Stepsnavigable. -
Forms set
Braced by 6 a.m. on the north wall. See the photos
Pour finished
38 cubic yards of 4,000 psi, placed from the northeast corner. See the ticket
Curing
Kept wet for seven days before it takes a load. See the schedule
Also new
-
Checkbox and radio Menu Items
Menu Item takes
type="checkbox"ortype="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(), fromslab-elements/strings.js, words what the elements say, such as "Dismiss" or "Next slide", for the nearestlang.
Accessibility, everywhere
From an accessibility audit of every component. A line each, and the components it's in.
Screenreaders
-
aria-*on a component's host reaches the element a screenreader reads. -
The browser's own message, in its language, when a built-in constraint fails.
-
Field's description and error describe its control, and mark it invalid.
-
Groups and Switch say when they're invalid.
-
Combobox announces how many results are left, and which tag was removed.
Keyboard
-
Left and Right follow the reading direction, right to left too.
-
Enter is left to an input method while it's composing.
-
A click on the label focuses the control, as a native select's does.
-
Toasts with an action stay open, and F6 moves focus to them.
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 thefocus-visiblepart.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
pnpm add slab-elements@0.2.0
Every change, in full, is in the release notes.