Slab
Slab

Changelog

Releases

Every release of Slab, newest first, with what's changed in each. It's the package's CHANGELOG.md, and the bigger releases have a page of their own, with live examples.

  1. 1.3.1

    • Command Palette's result count and its empty slot's text are announced by VoiceOver in Safari again. They're now announced from the palette's input, inside its modal dialog, rather than from the host. That also keeps them inside the dialog in browsers without ariaNotify(), where everything outside it is inert. There's nothing to update. #252
    • Copy Button's "Copied" and "Couldn't copy" are announced by VoiceOver in Safari. Safari's VoiceOver didn't read the status region they're announced from, so in Safari, and every browser on iOS, they're now also announced through an announcement of their own. Nothing changes in other browsers, and there's nothing to update. #251
    • Listbox now tells VoiceOver in Safari when Space or Enter selects or deselects the active Option. Safari doesn't pass the active Option on to VoiceOver, so before, the change often went unsaid. #254
    • Range Slider now tells VoiceOver in Safari the value a thumb moves to with Home or End. VoiceOver moves to the slider's label on those keys, so before, the new value went unsaid. Nothing changes in other browsers, and there's nothing to update. #258
    • Toast is announced by VoiceOver in Safari. Safari's VoiceOver doesn't announce content slotted into a live region, so in Safari, and every browser on iOS, show() now also announces the toast's text itself. Nothing changes in other browsers, and there's nothing to update. #250
    • Tree now tells VoiceOver in Safari when Enter or Space selects or deselects the active Tree Item. Safari doesn't pass the active item on to VoiceOver, so before, nothing was said. #253
  2. 1.3.0

    What's new in 1.3.0 Date Time Picker, drag and drop beyond reordering with Draggable and Drop Zone, Sortable Lists that trade items, and smaller bundles.
    • Date Time Picker
    • Draggable and Drop Zone
    All 5 changes
    • New component: Date Time Picker (slab-date-time-picker), a Date Time Field with a button that opens a Calendar and a time input in a popover, as Date Picker does for a date. #242

      • It's Date Time Field, so the value, the time zone select, validity and the form work the same.
      • Picking a day keeps the value's time, and changing the time keeps its day. The picker stays open until Escape or a click outside.
      • open, showPicker(), hidePicker(), "beforetoggle" and "toggle" work as on Date Picker, and so do months, week-start and isDateUnavailable.
      • Name the button with button-label and the time input with time-label, or with dateTimePickerButton and dateTimePickerTime in registerStrings().
    • New components: Draggable (slab-draggable) and Drop Zone (slab-drop-zone), for drag and drop beyond reordering, such as moving a card between the columns of a board. #243

      • Drag a Draggable by its handle, a <button>, with a mouse or a finger, and it follows the pointer. Or press Space or Enter on the handle to pick it up, the arrow keys to move between the Drop Zones that take it, Space or Enter to drop it, and Escape to cancel. Screenreaders hear each step.
      • Both dispatch the drag events native drag and drop does, as DragEvents with a DataTransfer, however the drag is made: "dragstart" and "dragend" on the Draggable, and "dragenter", "dragover", "dragleave" and "drop" on Drop Zones. Set what's dragged with dataTransfer.setData() in "dragstart", and read it with getData() in "drop".
      • Neither moves anything. Do what a drop means in the Drop Zone's "drop". "dragend"'s dataTransfer.dropEffect says whether the Draggable was dropped.
      • A Drop Zone takes what matches its accept, a comma-separated list of data types such as "application/x-task" or "text/*", and sets its drop-effect ("move", "copy" or "link") as the drag's dropEffect. It also takes native drags from outside Slab, such as a link from another window. Style it with :state(droppable) and :state(over), and a Draggable with :state(grabbed).
      • Word what screenreaders hear with instructions-label and the grabbedLabel, overLabel, droppedLabel, canceledLabel and noDropZonesLabel functions, or with the draggable* strings in registerStrings().
    • Sortable List has a group attribute. Sortable Lists with the same group trade items, like the columns of a board. #245

      • Drag an item over another list in the group and it moves there, landing where the pointer is among that list's items.
      • With the keyboard, Left Arrow and Right Arrow move a picked up item to the previous or next list in the group, in page order. They're swapped when text runs right to left.
      • When an item is dropped in another list, both lists dispatch "change". Escape puts it back in the list it came from.
      • Screenreaders hear "Walls moved to Done, position 1 of 2" and so on, which you can reword with movedToListLabel, or with sortableListMovedToList in registerStrings(). A grouped list's handles are described with the left and right arrow keys too (sortableListGroupInstructions).
    • Each element now bundles only its own English strings, rather than every element's, which takes up to about 1 KB, gzipped, off an app, however many elements it imports. registerStrings() and the Strings type are unchanged. #246
    • Table Row's published types declare TableRowSelection again. 1.2.0 left it out of table.row.class.d.ts while privateSetSelection() still named it, so a project that type-checks with skipLibCheck: false failed with "Cannot find name 'TableRowSelection'". #247
  3. 1.2.0

    What's new in 1.2.0 Date Time Field with time zones, row selection in Table, currency and unit formats in Number, unavailable days in Calendar, and class-only imports.
    • Date Time Field
    All 5 changes
    • Calendar can now mark days as unavailable and show more than one month at a time. Date Picker and Date Range Picker pass both to their Calendar. #230

      • isDateUnavailable is a function of a "yyyy-mm-dd" day that returns true for a day that can't be picked, such as a weekend or a day that's already booked. An unavailable day can still be focused, so the arrow keys move across it, but it can't be selected. It's aria-disabled and ::part(unavailable). With range, a range can't span an unavailable day. Set a new function when what it returns changes.
      • months shows that many months side by side. Each has its own grid and ::part(month-heading), and the heading between the buttons names them all. The months shown follow the focused day, and the previous and next buttons move them a month at a time.

      Calendar's grid is now inside two new parts, ::part(months) and ::part(month), which you can use to lay out several months. Styles that select Calendar's parts work as before.

    • Every element has a class module beside its registering one, such as slab-elements/tabs.class.js beside slab-elements/tabs.js. It exports the same class and registers nothing, so you can register the element under a tag of your own, in a scoped custom element registry, or on a page that might load two versions of Slab. A class module registers none of the element's parts either, so register those too. Elements find their parts by class, so any tag names work. Nothing changes for slab-elements/<name>.js, which still registers its tag and its parts' tags. #236

      When you subclass an element, import the class from its class module, so the slab- tag isn't registered along with yours.

      Date Picker and Date Range Picker now render their Calendar from a scoped registry of their own where the browser supports one, so they don't need slab-calendar registered globally. In browsers without scoped registries, register Calendar as slab-calendar when you use their class modules.

      sideEffects in package.json now lists the registering modules by name, so bundlers can drop an imported class module that goes unused.

    • New component: Date Time Field (slab-date-time-field), a date and time field around a native <input type="datetime-local">, with a native select of time zones beside it. #235

      • value is the native input's "yyyy-mm-ddThh:mm" wall-clock time, and min, max, step and validity are the input's own.
      • time-zone is an IANA name, such as "America/Chicago", and the browser's own when unset. The person can change it from the select, which lists every time zone the browser knows, or those in time-zones, each with its offset from UTC at the value's date. Changing it dispatches "input" and "change" and keeps the value.
      • The value is submitted under name, and the time zone under time-zone-name when it's set.
      • valueAsDate is the moment the value is in its time zone, and setting it writes that moment's wall-clock time.
      • Name the select with time-zone-label, or with dateTimeFieldTimeZone in registerStrings().
    • Number has a format-options attribute, and a formatOptions property, that take Intl.NumberFormat options for a currency, a percent or a unit, such as format-options='{"style":"currency","currency":"USD"}'. The field shows its value formatted in the language of the nearest lang, and reads what's typed, such as "$1,234.50" or "12 %", back into a number. value and the submitted value stay a plain number, and a percent's is a fraction, as Intl formats one, so 0.12 shows as 12%. Text that isn't a number is badInput, with the message "Enter a number.", which registerStrings() translates as numberBadInput. Without format-options, Number is the native number input it was. #229
    • Table rows can be selected. Set selectable on a Table for one row at a time, or multiple for more than one, and each body row starts with a check box that selects it, named "Select" and its row header's text. With multiple, the head row gets a check box that selects every row, or none, and Shift with a click selects a range. Table dispatches "change" when the user changes the selection, and has selectedRow and selectedRows. Table Row has selected and disabled, :state(selected), :state(selectable) and :state(disabled), and checkbox and selection-cell parts. Name the check boxes with select-all-label, selection-label and selectRowLabel, or with tableSelectAll, tableSelectRow and tableSelection in registerStrings(). #228
  4. 1.1.0

    What's new in 1.1.0 Validation errors from markup, more of the native form, field and popup APIs, and Ember types.
    All 9 changes
    • Every form control now has a custom-validity attribute and a validity-message slot, to make validation errors easier to show. #216

      • custom-validity is setCustomValidity() from markup. The control is invalid with that message, and the message shows right away, without waiting for validity to be reported. Use it for errors you already know about, such as ones from a server. Remove it, or set it to an empty string, to make the control valid again.
      • Content in the validity-message slot shows in place of the validity message's text, while the control is invalid and its message shows. Use it for wording of your own, a translation or a link. validationMessage is unchanged.

      Cancelling a control's "invalid" event now keeps its validity message unshown, as its documentation said, and as cancelling one on a native control keeps its validation bubble from showing. That covers a blur, a submit and reportValidity(). On a submit, the control isn't focused either. The control stays invalid.

      Also fixed: on Checkbox, Checkbox Group, Combobox, Listbox, Radio Group, Rating, Select and Switch, a message from setCustomValidity() on a control that wasn't required was cleared by the control's next update.

      Code that doesn't cancel "invalid" works as before.

    • Form controls now have the defaults that native inputs have. The fields, Select, Combobox, Listbox, Slider and the other controls that take one value have defaultValue. Checkbox, Switch and Radio have defaultChecked, and Option has defaultSelected. Range Slider and Date Range Field (and Picker) have defaultStartValue and defaultEndValue. Checkbox Group and Radio Group reset through their Checkboxes' and Radios' defaultChecked, and File Drop, like a file input, has no default. Each is the attribute the control starts with and goes back to when its form resets, so reading it reads the attribute, and setting it sets the attribute. Nothing changes for existing code. #211
    • Ember templates can now be type-checked with Glint. Add import type {} from 'slab-elements/ember.js'; once, in a .d.ts file. Glint then checks each tag's attributes by their HTML names, such as hide-label and orientation, so a misspelled attribute or a wrong value is a type error. SlabElementAttributes in slab-elements/jsx.js maps each tag to its attributes, for other frameworks that set attributes. Nothing changes for existing code. #217
    • Every form control now has a read-only labels, as native inputs do. It's the <label> elements associated with the control, from ElementInternals.labels: each <label for> that names its id, and a <label> around it. Nothing changes for existing code. #213
    • Clicking a form control's outside label now does what it does for a native control, whether it's a <label for> that names the control's id or a <label> around it. Checkbox and Switch toggle, File Drop opens its file picker, and every other control takes focus. Before, Checkbox and Switch were focused without toggling, and Select, Listbox, Radio Group, Checkbox Group and Rating did nothing. A control's accessible name still comes from its own label attribute. Nothing else changes for existing code. #215
    • Select and Combobox have a showPicker() method, as Date Picker and Date Range Picker do. It opens the listbox, and like a native select's or input's, it throws a "NotAllowedError" when it isn't called from a user gesture, such as a click or a key press, and an "InvalidStateError" while the component is disabled, or while a Combobox is read-only. To open one from code without a user gesture, call show() or set open. #209
    • Slider and Range Slider have stepUp(count?) and stepDown(count?) methods, as a native range input does. They step the value by step times count, which is 1 when left out, keep it to min and max, and dispatch no "input" or "change". Slider's throw an InvalidStateError when step is "any", as a range input's do. Range Slider's take the thumb to step as a second argument, "start" or "end", and step the thumb that has focus, or the start thumb, when it's left out. A thumb stops at the other thumb, as it does with the keyboard. #210
    • Text Field, Textarea, Search Field and Password Field have selectionStart, selectionEnd and selectionDirection properties and a setRangeText() method, as a native input and textarea do, beside the select() and setSelectionRange() they already had. Each works on the input or textarea inside, so it behaves as a native one: setRangeText() updates value and dispatches no "input" or "change", and on a Text Field with type="email" the properties are null, and setting them, setSelectionRange() and setRangeText() throw an "InvalidStateError", as on an email input. Nothing changes for existing code. #214
    • Menu, Context Menu, Select, Combobox, Tooltip and Hover Card have a toggle(force?) method, as Popover and Navigation Menu Item do. Like a native popover's togglePopover(), it opens the component when it's closed and closes it when it's open, true only opens it and false only closes it, and it returns whether the component is open afterward. It returns false when the component stays closed, such as while it's disabled or when a "beforetoggle" listener cancels opening. Context Menu opens below whatever in its target has focus, and toggle(true) leaves an open one where it is. #207
  5. 1.0.0

    What's new in 1.0.0 A stable API: typed events for every framework, custom states in the manifest, and validity, read-only fields and opening from code where they were missing.
    All 41 changes
    • Slab 1.0.0. The API is stable: from here, nothing is removed without a deprecation first, and a deprecated API lasts until the next major version. Every change since 0.1 that can break something, and what to change for each, is in Upgrade to 1.0. #134

      This 1.0 release is dedicated to my childhood friend, Doug Miller. We were friends for 30 years. He got me into web development and open source software. He lost his battle with melanoma last year. Today is his birthday. So I dedicate this to him. Rest in peace, buddy. I love and miss you.

      If you'd like to remember Doug too, please consider a donation to the Melanoma Research Alliance, which funds melanoma research.

    • Breaking: Checkbox Group's list of checked values moves from value to values, the way Listbox, Select, Combobox, Tags Input and Toggle Group have it. value is now a string, the first of them, and setting it checks only that Checkbox. #104
    • Breaking: Checkbox's indeterminate is a property only, with no attribute, as on a native checkbox, and resetting its form leaves it as it is. Set it from script. #152
    • Breaking: Dialog, Alert Dialog, Command Palette and Drawer open the way a native <dialog> does. The new showModal() opens them as a modal. show() and setting open open them non-modally, so the rest of the page stays usable and Escape only closes them with closedby. Dialog, Alert Dialog and Command Palette used to open as a modal from either. #151

      For a modal opened declaratively, as a framework that binds open does, add the new modal attribute: <slab-dialog modal open> opens as showModal() does. A native <dialog> has no modal, so it's Slab's own. Otherwise, call showModal() where you called show() for a modal.

    • Breaking: Grid List's selection-mode is replaced by selectable and multiple, the same multiple as Listbox, Select, Combobox and Tree. selection-mode="single" is now selectable, and selection-mode="multiple" is now multiple, which makes rows selectable without selectable. #103
    • Breaking: Password Field's show-and-hide button dispatches "reveal-change" instead of "toggle". "toggle" is the ToggleEvent that elements with open dispatch, and Password Field's wasn't one. Read revealed in the handler for whether the password shows. #114
    • Breaking: Date Picker's and Date Range Picker's showPicker() throw as a native input's does: a "NotAllowedError" without a user gesture, and an "InvalidStateError" while disabled or read-only. Set open to open the calendar from code. #152
    • Breaking: Toast's "dismiss" can be canceled to keep the toast shown, as Alert's can. So it's now dispatched before the toast hides rather than after, and open is still true in a "dismiss" listener. #116
    • Every element with open now dispatches "toggle" when it opens and closes, as a ToggleEvent with oldState and newState: #102

      • Menu, Context Menu, Select and Combobox dispatch it for the first time.
      • Breaking: Tooltip and Hover Card's "toggle" is now a ToggleEvent that, like a popover's, doesn't bubble and isn't composed. Listen on the element itself rather than on an ancestor.
    • The package includes an agent skill, skills/slab, that teaches coding agents such as Claude Code, Cursor and Codex to use Slab: which component fits, its native events and methods, forms and validity, styling with ::part() and :state(), and what not to do for accessibility. A reference page for each component, built from custom-elements.json, comes with it. Add it with npx skills add ynotdraw/slab-elements --skill slab, or copy it from node_modules/slab-elements/skills/slab. LLMs and agents has more. #185
    • Every attribute, property, method, event, slot and part in custom-elements.json now has a description, so editors show one on hover and each component's page fills in its API tables. Most were the ones many elements share, such as label, disabled, "change" and the validity methods. #115
    • Combobox, Select, Menu, Context Menu, Tooltip, Hover Card, Date Picker and Date Range Picker dispatch "beforetoggle" before they open or close, as Popover does. Cancelling it while one is opening keeps it closed, and open stays false. #129
    • Combobox and Tags Input have readonly, as the other fields that take typing do. The value can't be changed, but it's still focusable and submitted and never invalid. A Combobox's listbox doesn't open, and the tags of both are text rather than buttons that remove them. #125
    • Every element's custom states are now in the elements manifest as cssStates, in each component's JSDoc as @cssstate, and on its docs page, each with what it means. A design selects them with :state(), so they're public API like parts. #124
    • Slider, Range Slider, Color Picker and Editable have the validity API the other form controls do: setCustomValidity(), setValidity(), validationMessage, willValidate and resetValidityFeedback(), with a validity-message part and :state(error). Their values are never invalid on their own, so this is for rules of your own. Their description part is now a <div> around the description slot and the validity message, as on Text Field, rather than the slot itself. #126
    • Dialog, Drawer, Alert Dialog and Command Palette have requestClose(returnValue), as a native <dialog> does. It dispatches a cancelable "cancel" and closes only when that isn't canceled. #133
    • Dialog, Drawer, Alert Dialog, Command Palette and Toast dispatch "toggle" when they open and close, as a ToggleEvent with oldState and newState that doesn't bubble, so every element with open now does. #123
    • Editable dispatches "input" just before "change" when a committed edit changes its value, as a native <select> does, so it fires both events like every other field. It still doesn't dispatch "input" while typing, because value only changes when an edit is committed. #137
    • The package includes editor data, so editors autocomplete Slab's tags in plain HTML, with each attribute's values and a description on hover, and its ::part() and :state() names in CSS. WebStorm and the other JetBrains editors read web-types.json on their own. For VS Code, add slab-elements/dist/vscode.html-custom-data.json to html.customData and vscode.css-custom-data.json to css.customData, as Get started shows. #191
    • Types for using Slab's elements in React, Svelte 5 and Vue templates. Import your framework's once, such as import type {} from 'slab-elements/react.js', and every tag's properties are checked. SlabElementProps in slab-elements/jsx.js lists them for any other framework. #109
    • custom-elements.json and the React, Vue and Svelte types list the "invalid" event on each of the 25 form controls that validate, as a native control has it. It was dispatched all along, but no element listed it. #138
    • Rating has readonly, for showing a rating that can't be changed. It's still focusable and submitted with its form, and it doesn't preview a value under the pointer. #117
    • Combobox, Tooltip and Hover Card have show() and hide(), as the other elements with open do. Tooltip's and Hover Card's skip open-delay and close-delay, and Hover Card's hide() gives focus in the card back to its anchor, as Escape does. #128
    • Slider has valueAsNumber, like Number and a native range input, for its value as a number. value stays a string, as a native input's is. #105
    • Copy Button, Hover Card, Steps Step, Toggle Button, Toggle Group and Tooltip match :state(disabled) while they're disabled, as every other element with disabled does. #136
    • Dialog, Drawer, Alert Dialog, Command Palette, Date Picker, Date Range Picker, Disclosure, Popover and Navigation Menu Item match :state(open) while they're open, as every other element with open does. #135
    • Toggle Group has disabled, which disables every button in it, as Checkbox Group and Radio Group's do. #106
    • The framework types now type each element's events. In React 19 and Svelte, a handler such as oncopy-error or onchange gets the event, typed as the element dispatches it, with the element as its currentTarget, and Vue checks @copy-error the same way. slab-elements/jsx.js adds SlabElementEvents, every tag's events, and SlabEventHandler, for any other framework. #127
    • Calendar tells screenreaders which day is picked without range, as it already did with range, since a focused day's selection changing isn't read out on its own. selectedLabel changes what they're told. #174
    • Command Palette tells screenreaders the text slotted into empty once typing pauses with nothing matching. Before, it was put in a status region, which neither VoiceOver in Safari nor in Chrome read out when the slot was filled. Its empty part is no longer a status region. #176
    • A form control's form data and validity are current as soon as its value changes, as a native control's are, whether the user changed it or code did. Before, they trailed by an update: #146

      • Inside Radio Group's "input" and "change", value and the form data were the previous choice, with both the old Radio and the new one checked. Inside Checkbox Group's "input", value, values and the form data were the previous ones.
      • Inside "input", and sometimes "change", new FormData(form) had the previous value for Checkbox, Switch, Text Field, Textarea, Search Field, Password Field, Number, Pin Input, Slider, Range Slider, Rating, Editable, Color Picker, Date Field, Date Range Field, Time Field and File Drop, and validity could be stale too.
      • Setting value, values or checked from code, on a control or on a Radio or Checkbox in a group, left new FormData(form) and validity as they were until the next update.
      • In Date Range Field, validity didn't follow when one date moved the other's bound.

      setCustomValidity('') on Checkbox, Switch, Rating, Radio Group, Checkbox Group, Combobox, Listbox, Select and Tags Input now clears only the custom error, as it does natively, so a required control that's still empty stays invalid with valueMissing. Before, it made the control valid, and once a message had been set, the control stopped validating itself at all.

    • The published package no longer asks for Node 20 and pnpm 12. Those were for working on Slab itself, and a project that installs it with npm, Yarn or an older pnpm no longer gets an engines warning or, with engine-strict, an error. #118
    • The protected hooks that Slab's own subclasses override, such as Dialog's renderContent() and Date Field's renderControl(), are left out of the published types and custom-elements.json. They were never documented and aren't public API, so they can change without a major version. Subclass an element to set styles, as the docs show. #110
    • Password Field, a Text Field whose type is "password", and a masked Pin Input no longer have their value restored by the browser after navigating back or restoring a session, as a native password input doesn't. Neither does a Text Field or Pin Input with autocomplete="off". #153
    • The published custom-elements.json no longer lists the "private-*" events Slab's elements dispatch to each other, or the read-only version attribute, so editors and framework tooling stop suggesting them. #108
    • Select tells screenreaders which Option typing selects while it's closed, as a native <select> does. Before, the Select's text changed without anything being read out. #173
    • Importing an element on a server, as Next.js, Astro and SvelteKit do while rendering a page, no longer throws "window is not defined". The elements still render in the browser. #107
    • Popover's and Navigation Menu Item's toggle(force) take force and return whether they're open, as a native popover's togglePopover(force) does. true only opens, and false only closes. #152
    • Every element's version property and attribute are marked internal, so they're out of the published types, custom-elements.json and the framework types. They're still there at runtime, for seeing which Slab registered an element, but they aren't public API. #119
    • Elements no longer pull Slab's whole package.json into your bundle to read the version. That was about 9 KB before compression, shared by every element you imported. #101
    • Listbox, Combobox, Select, Command Palette, Menu, Context Menu and Tree now tell VoiceOver which item is active in Safari. Safari doesn't pass aria-activedescendant on to VoiceOver when it's set as an element reference, which is the only way to point from a shadow root at slotted items, so arrowing through them was silent. In WebKit, the active item is now announced as it changes, with "selected" when it is, as React Aria does on Apple devices. #177
  6. 0.3.1

    What's new in 0.3.1 Eight new components, from Table to Date Range Picker, submenus in Menu, and Listboxes of thousands of Options.
    • Table
    • Alert Dialog
    • Toggle Button
    • Grid List
    • Date Picker
    • Search Field
    • Date Range Picker
    • Sortable List
    All 11 changes
    • Adds Alert Dialog, slab-alert-dialog: a modal Dialog with role="alertdialog" for a question that needs an answer, such as confirming a delete. It has a built-in Cancel button that focus starts on, a description that's read with the label, and no light dismiss. Change the Cancel button's text with cancel-label, or with alertDialogCancel in registerStrings(). #86
    • Adds Date Picker, slab-date-picker: a Date Field with a button that opens a Calendar in a popover, so the picker looks and works the same in every browser and can be styled. Pick a day with the mouse or keyboard, or open it with Alt+ArrowDown from the input. #88
    • Adds Date Range Picker, slab-date-range-picker: a Date Range Field with a button that opens a range Calendar in a popover, so the start and end are picked in one calendar that looks and works the same in every browser and can be styled. Open it with the button or with Alt+ArrowDown from either input. #96
    • Adds Grid List, slab-grid-list and slab-grid-list-item: a list of rows that can hold their own buttons, links and checkboxes, like React Aria's GridList. Tab reaches it once, Up and Down move between rows, Left and Right move between a row and its controls, and Escape goes back to the row. Set selection-mode to "single" or "multiple" to select rows with a click, Space or Enter. #98
    • Hover Card points its anchor's aria-details at the card's content, so a screenreader can tell there's more about the anchor, and has a label attribute that makes the card a group named by it. #90
    • Menu has submenus. Put a slab-menu inside another with a slab-menu-item as its anchor, and it opens beside that Menu Item. The Right arrow, Enter, Space, a click, or resting the pointer on the Menu Item for a moment opens it. Left and Escape close it and return focus to its Menu Item, and a click on any Menu Item in it closes every Menu. In a right-to-left page, Left and Right swap. #97
    • Adds Search Field, slab-search-field: a native search input with a button that clears it, and Escape that clears it in every browser. It's form-associated like Text Field. #87
    • Adds Sortable List, slab-sortable-list and slab-sortable-list-item: a list the user puts in order by dragging each item's handle, or with Space, the arrow keys, Home and End. Screenreaders are told where an item is as it's picked up, moved, dropped or put back. #89
    • Adds Table, slab-table, with slab-table-head, slab-table-body, slab-table-foot, slab-table-row, slab-table-column-header and slab-table-cell: a table that components can render rows and cells into, laid out like a native <table> with the same roles. A sortable Column Header is a button that sorts its column, sets aria-sort, dispatches "sort" and tells screenreaders how the column is sorted. Change what they're told with tableSorted in registerStrings(). #94
    • Toggle Button is new: a native <button> with aria-pressed, for one setting that's on or off, such as Bold or Mute. A click, Space or Enter presses it or releases it. #85
    • Listbox and Combobox have a virtual attribute for lists of thousands of Options. Only the Options in or near view are laid out, with spacers in place of the rest, while the keys, typeahead, filtering and selection still reach every Option. Rendered Options get aria-posinset and aria-setsize, and the active one stays in the accessibility tree when it's scrolled away from. #99

      Listbox and Combobox are also much faster with long lists whether or not they're virtual: they no longer do work for every Option each time one of them connects or changes, which made a thousand Options take seconds to appear.

  7. 0.3.0

    What's new in 0.3.0 Values screenreaders read the way you mean them, headings in Disclosure, dialogs in Popover, and the rest of the accessibility audit.
    All 14 changes
    • Splitter's separator holds a visually hidden range input, which is what's focused and what screenreaders read, so screenreaders on phones can move it with a swipe up or down. The separator is no longer a [role=separator] itself, so screenreaders read it as a slider, and since it isn't focused, it doesn't match :focus-visible: style its focus ring through its new focus-visible part, as in ::part(separator focus-visible). #68
    • With range, Calendar tells screenreaders when the first day picked starts the range, and what the range is once the last is picked. Change what it says with rangeStartedLabel and rangeSelectedLabel. #74
    • The styled Checkbox's box is 24 pixels square rather than 22, the smallest target size WCAG 2.5.8 allows. #71
    • Color Picker's area-thumb, hue-thumb and alpha-thumb parts are listed in the elements manifest again, so editors and the docs show them. #70
    • Command Palette tells screenreaders how many Options are left once typing pauses, the way Combobox does. Set resultsLabel to change what it says. With none left, what's slotted into empty is announced instead, as before, or "No results" when nothing is. #72
    • Disclosure has a heading-level attribute that makes its label a heading of that level, as the APG's accordion puts each header in one. #75
    • File Drop tells screenreaders what a drop did: how many files were added, how many were left out for not matching accept, and when a drop of several files was ignored without multiple. Change what it says with addedLabel, notAcceptedLabel and too-many-label. #73
    • Meter has a formatValue property, a function of the value whose result screenreaders read instead of the bare number, such as "3 of 5 GB". #79
    • Popover has a label attribute that makes it a non-modal dialog named by the label, with aria-haspopup="dialog" on its anchor, for a popover that holds a form or controls rather than a few words. #76
    • Progress has a formatValue property, a function of the value whose result screenreaders read instead of a percentage, such as "3 of 10 files". #80
    • Range Slider has a formatValue property, a function of a thumb's value whose result screenreaders read instead of the bare number, such as "$40". #78
    • Range Slider's start and end parts are listed in the elements manifest again, so editors and the docs show them. #69
    • Rating has a formatValue property, a function of each radio's number that names it, such as "3 stars" rather than "3". #81
    • Slider has a formatValue property, a function of the value whose result screenreaders read instead of the bare number, such as "$40". #77
  8. 0.2.0

    What's new in 0.2.0 Ten new components, from Command Palette to Feed, translations, and an accessibility pass over the rest.
    • Command Palette
    • Hover Card
    • Navigation Menu
    • Tags Input
    • Editable
    • Date Range Field
    • Copy Button
    • Password Field
    • Steps
    • Feed
    All 27 changes
    • Color Picker's thumbs each hold a visually hidden range input, which is what's focused and what screenreaders read, so screenreaders on phones can adjust them with a swipe up or down. The area has a second one for its brightness, "Brightness" after label, left out of the tab order. The thumbs are no longer [role=slider]s themselves, and since they aren't focused, they don't match :focus-visible: style a thumb's focus ring through its new focus-visible part, as in ::part(hue-thumb focus-visible). #63
    • Range Slider's thumbs each hold a visually hidden range input, which is what's focused and what screenreaders read, so screenreaders on phones can adjust them with a swipe up or down. The thumbs are no longer [role=slider]s themselves, and since they aren't focused, they don't match :focus-visible: style a thumb's focus ring through its new focus-visible part, as in ::part(start focus-visible). #62
    • Combobox now tells screenreaders how many Options are left once typing pauses ("No results", "1 result", "3 results"), and which tag was removed when multiple is set. Before, filtering and removing a tag happened silently. Both messages can be replaced, through resultsLabel and removedLabel. #61
    • aria-* attributes on a component's host now reach the element a screenreader reads, such as Text Field's <input> or Disclosure's <summary>, in Checkbox, Color Picker, Combobox, Date Field, Disclosure, File Drop, Number, Pin Input, Range Slider, Slider, Switch, Text Field, Textarea and Time Field. Before, an aria-label or aria-describedby you put on the host went unread, and so did the description Tooltip gives its anchor and the aria-expanded Popover and Menu give theirs when the anchor was one of these. ID references, such as aria-describedby, are resolved where the host is and kept in step as they change. #52
    • Carousel's autoplay no longer rotates when the user prefers reduced motion, and it stops for good once focus moves into the carousel, as the APG's carousel does, rather than starting again when focus leaves. The rotation button starts it in either case. #53
    • Adds Command Palette, slab-command-palette: a modal search for commands. It's Dialog, with a Combobox's <input role="combobox"> and a listbox of slotted Options inside, so it has Dialog's open, show(), close(), closedby, label, focus trap and "cancel" and "close". Opening it empties the input and focuses it. Typing filters the Options by filter, a case-insensitive substring of their text by default, and makes the first match active, so Enter runs the best one. Up and Down move the active Option. Enter or a click closes the palette with the chosen Option's value as returnValue. A Close button beside the input closes it without choosing, which matters on phones where closedby="any" isn't supported, and the close slot changes what it says. Closing it any way other than choosing leaves returnValue empty. query is what's been typed, and the input's "input" leaves the host, for fetching results as the user types. When nothing matches, the listbox is hidden, the host matches :state(empty), and the empty slot is shown in a status region. Style it through ::part(dialog), ::part(label), ::part(input), ::part(close), ::part(listbox) and ::part(empty). #45
    • Adds Copy Button, slab-copy-button: a native <button> that writes text to the clipboard when it's pressed. It copies value, or, with from, the value or rendered text of the element with that id at the moment it's pressed, so a code block or an input can be copied without keeping value in step. Once copied, copied-label ("Copied") is announced from a status beside the button, the host matches :state(copied) for feedback-duration (2000ms by default), and "copied" is dispatched. When the clipboard refuses, as it does in a page that isn't served securely, failed-label is announced, the host matches :state(failed), and "copy-error" is dispatched instead. Style it through ::part(button), :state(copied) and :state(failed). #42
    • Adds Date Range Field, slab-date-range-field: two native date inputs, a start and an end, for picking the first and last days of a range. Each input's bound is the other's value, so a browser's picker won't offer an end before the start, and an end typed before it is rangeUnderflow and rangeOverflow, as a date outside min and max is on a single input. start-value and end-value are ISO "yyyy-mm-dd" strings, and the form gets both under name, the start and then the end. The group is named by label, and each input by it and start-label or end-label, "Start" and "End" unless you set them. Style it through its parts and :state(disabled), :state(error), :state(readonly) and :state(required). #36
    • Adds Editable, slab-editable: text that's edited in place, such as a title or a name. It's a native button showing the value, named by label and then the value, that becomes a native input when it's pressed, with the text selected. Enter commits what's typed and Escape discards it, and both put focus back on the button. Moving focus away commits it too. value is the last committed value, and it's what the form gets under name. "change" is dispatched when an edit is committed with a different value. edit(), commit() and cancel() do what the keys do, and editing says which is showing. While it's empty, the button shows placeholder. Style it through ::part(preview), ::part(input), ::part(label) and ::part(description), and :state(disabled), :state(editing) and :state(empty). #41
    • Adds Feed, slab-feed: the APG's feed, a [role=feed] of articles that grows as the user scrolls, like a timeline. Each slotted element is an article, put in the tab sequence and given aria-posinset and aria-setsize, so a screenreader says where it is. It's a [role=article] unless it's an <article> or has a role, and it's named by its first heading unless it has a name. Page Down and Page Up move focus to the next and previous article from anywhere in one, and Control+End and Control+Home move focus to what's after and before the feed. Loading is yours: add articles and set busy while you do. total is how many articles there are in all, or -1 when that's unknown, and the number there are now when unset. The feed is named by label. Style it through ::part(feed). #40
    • Field now describes its control by what's slotted into description, through the control's aria-describedby, after any IDs it already has, and sets the control's aria-invalid while error is set. Before, a screenreader read neither the hint nor the error, nor that the control was invalid. #54
    • Color Picker keeps the colors being picked from in forced colors, such as Windows' contrast themes. Before, the browser painted the area, the hue and alpha sliders and every swatch in the user's background color, so there was nothing to pick from. #51
    • Checkbox Group and Radio Group now tell screenreaders when they're invalid. Radio Group sets aria-invalid on its radiogroup. A group role can't take aria-invalid, so Checkbox Group sets it on each of its Checkboxes instead. Both follow the Group's validity feedback, so they're marked once its validity is reported and cleared once it's valid. #56
    • Adds Hover Card, slab-hover-card: a preview of what a link leads to, slotted beside its anchor in a native [popover] in the top layer. It opens when the anchor is hovered or focused by keyboard, after open-delay (700ms by default), and closes when the pointer leaves, after close-delay (300ms), when focus leaves it, and on Escape. Unlike Tooltip's, its content can hold links and buttons, which follow the anchor in the focus order, so Tab moves into the card. A touch doesn't open it. placement picks the side it opens on, and it flips when there's no room. Style it through ::part(card) and :state(open). #35
    • Text Field, Number, Pin Input and Combobox now leave Enter to an input method while it's composing, such as one for Japanese or Chinese. Before, the Enter that confirms a conversion submitted the form, or chose the active Option in Combobox. Safari's composition-ending Enter, which doesn't set isComposing, is recognized too. #48
    • Menu Item has a type of checkbox or radio, which makes it a menuitemcheckbox or menuitemradio with aria-checked, checked, and :state(checked). A click checks it before any "click" listener hears it. The new Menu Group, slab-menu-group, is a named [role=group] for a set of radio Menu Items in a Menu or Context Menu. Its Menu Items are still the Menu's, so the arrow keys and typeahead move through them as through the rest. #58
    • Adds Navigation Menu, slab-navigation-menu, and Navigation Menu Item, slab-navigation-menu-item, for a site's navigation. It's the APG's disclosure navigation rather than a [role=menu]: a <nav> named by label, around a <ul> with an <li> for each link and Item. Each Item is a <button> with aria-expanded, named by its label, that shows and hides a list of links of its own. Opening one Item closes the others, and Escape, a click outside an Item, or focus leaving it closes it. Tab goes through every link and button. Left and Right move along the row, Down on an Item's button opens it at its first link, and Up and Down move between its links. An Item's content is in the flow below its button, and display: none while closed, so a design positions it. Items have open, show(), hide(), toggle() and a "toggle" event. Style them through ::part(nav), ::part(list), ::part(item), ::part(trigger) and ::part(content). #38
    • The new Option Group, slab-option-group, is a named [role=group] of Options for Listbox, Select and Combobox. Its Options are still the Listbox's, Select's or Combobox's, so the arrow keys, typeahead and selection work across groups as across the rest. Combobox hides an Option Group while its filter hides every Option in it. #59
    • Adds Password Field, slab-password-field: a native password input with a button that shows and hides the password. The button is a toggle button named by toggle-label ("Show password" by default) whose aria-pressed follows revealed, and it fires "toggle" when pressed. While the password shows the input is a text input, with spellcheck, autocorrect and autocapitalize off. revealed works like value, so the attribute is the default and a form reset hides the password again. It's form-associated with Text Field's API: required, minlength, maxlength, pattern, autocomplete, setCustomValidity(), setValidity() and a validity message. Style it through ::part(control), ::part(input), ::part(toggle-button) and :state(disabled), :state(error), :state(readonly), :state(required) and :state(revealed). #44
    • Left and Right now follow the reading direction in Tabs, Toolbar, Toggle Group, Radio Group, Menubar, Tree, Calendar, Color Picker's swatches and Combobox's tags. In a right-to-left page, Left moves to the next item, as it does for native radios, Tree expands with Left and collapses with Right, Calendar moves forward a day with Left, and Combobox moves from the start of its input to its tags with Right. #49
    • A click on Select's or Listbox's label now focuses it, as a click on a native select's label does. Nothing happens while it's disabled. #60
    • Adds Steps, slab-steps, and Step, slab-steps-step, for showing where the user is in a task of several steps, such as a checkout or a setup wizard. It's an <ol> named by label, with an <li> for each Step. The Steps before step are complete, the one at it is current and has aria-current="step", and the rest are upcoming. Past the last Step, every one is complete. Each Step shows its number, its label from the default slot, and a description slot, and a complete one has complete-label ("Completed" by default) after its label, hidden visually, for screenreaders. With navigable, each Step is a <button>, and clicking one sets step and dispatches "change"; disabled keeps the user off Steps they can't go to yet. next() and previous() move it along from your own buttons. Style it through ::part(list) and ::part(item), and each Step through ::part(step), ::part(indicator), ::part(label), ::part(status), ::part(description) and :state(complete), :state(current), :state(upcoming) and :state(navigable). #43
    • Adds registerStrings(), from slab-elements/strings.js, for translating the words Slab's elements say on their own, such as Alert's "Dismiss", Pagination's "Page 3" or Carousel's "Next slide". An element uses the strings registered for its nearest lang, then for that language without its region, and then English. An attribute or property set on the element still wins. Calendar also numbers its days in its language's digits, such as Arabic-Indic ones under lang="ar-EG". #64
    • Switch now shows when it's invalid, the way Checkbox does. Before, a required Switch left off blocked submission without saying why. Once its validity is reported it sets aria-invalid and :state(error) and shows a validity-message part, worded by the browser unless you give it one. It also has validationMessage, willValidate, setCustomValidity(), setValidity(), and resetValidityFeedback(). #55
    • Adds Tags Input, slab-tags-input: a native text input that turns what's typed into tags, for values with no list to pick from. Enter adds what's typed as a tag, and so does typing delimiter (a comma by default), so a pasted list becomes several tags. Tags are trimmed and not repeated, max caps how many the user can add, and what's typed is added when focus leaves. Each tag is a <button> that removes it, named by removeLabel, and the keyboard is Combobox's with multiple: Backspace in an empty input removes the last tag, and Left moves to the tags. values lists the tags, each submitted as its own entry, and the value attribute is the starting tags separated by commas. It's form-associated, with required, setCustomValidity(), setValidity() and a validity message. Style it through ::part(tag), ::part(tags), ::part(input) and :state(disabled), :state(empty), :state(error), :state(full) and :state(required). #37
    • Toast no longer dismisses itself on a timer when it has something to act on, such as an Undo button or a link, whatever duration says (WCAG 2.2.1). F6 now moves focus to the open toast shown most recently, and F6 from inside it moves focus back, as react-aria's toasts do. Dismissing a toast with focus in it moves focus back too. #57
    • Text Field, Textarea, Number, Date Field, Time Field, File Drop, Checkbox, Checkbox Group, Radio Group, Listbox, Select, Combobox, Rating and Pin Input now show the browser's own validity message, in the browser's language, when one fails a built-in constraint and you haven't given it a validity-message. Before, a required field left empty was invalid but said nothing, so a screenreader user wasn't told why the form wouldn't submit. Each also has validationMessage and willValidate, as a native control does. #50
  9. 0.1.3

    What's new in 0.1.3 Nine new components, from Menubar to Color Picker, and ranges of days in Calendar.
    • Menubar
    • Context Menu
    • Carousel
    • Color Picker
    • Rating
    • Pin Input
    • Splitter
    • Range Slider
    • Time Field
    • Calendar ranges
    All 11 changes
    • Adds range to Calendar, slab-calendar, to select a range of days rather than one. The first day picked starts the range and the second ends it, in either order, and "change" is dispatched once both are. value is then the range as "yyyy-mm-dd/yyyy-mm-dd", the ISO 8601 form of an interval. While the range is being picked, the days from the first to the one focused or hovered are ::part(preview), and Escape starts over. The range's days are ::part(selected) and its ends ::part(range-start) and ::part(range-end), and the grid is aria-multiselectable. #18
    • Adds Carousel, slab-carousel: a region of slides, following the APG carousel pattern. The slides are a CSS scroll snap container, so swiping, scrolling and the arrow keys move between them natively in every browser. Previous and Next, a marker per slide, and a rotation button when autoplay is set are real buttons, rather than the ::scroll-button() and ::scroll-marker pseudo-elements only Chromium has, so they're named and styled the same everywhere. index is the current slide's, loop wraps Previous and Next, and autoplay moves on every interval milliseconds, pausing while the carousel is hovered or focused. Slides out of view are inert. Style it through its parts and :state(first), :state(last) and :state(rotating). #25
    • Adds Color Picker, slab-color-picker: a saturation and brightness area, a hue slider, an alpha slider with alpha, a hex field, and swatches from swatches. The area and the sliders are [role=slider]s, stepped with the arrow keys, Page Up and Page Down, and Home and End, or dragged, and the swatches are a listbox whose selection follows focus. value is a lowercase "#rrggbb", or "#rrggbbaa" with alpha, and the form gets it under name. Style it through its parts, :state(disabled) and :state(dragging), and the --color-picker-hue, --color-picker-opaque and --color-picker-value custom properties it sets. #27
    • Adds Context Menu, slab-context-menu: Menu's Menu Items in a [role=menu] popover that opens over whatever is slotted into target, in place of the browser's own menu. It opens at the pointer on a right-click or Control-click, where it was pressed on a long-press with a finger or a pen, and below what has focus on Shift+F10 or the Menu key. It's kept on screen, flipping up or back when there isn't room, and it has Menu's keyboard. Prevent the default of a "contextmenu" in part of the target to keep it from opening there. Style it through its parts and :state(open). #26
    • Adds Menubar, slab-menubar: a row of Menus, such as File, Edit and View, following the APG menubar pattern. Each Menu's anchor becomes a [role=menuitem] in a [role=menubar] with a roving tabindex, so Tab reaches it once and Left, Right, Home and End move between the anchors. While a Menu is open, Left and Right close it and open the one beside it, and pointing at another anchor does the same. Opening, closing and moving through each Menu's items is Menu's own. Style it through ::part(menubar). #22
    • Adds Pin Input, slab-pin-input: a PIN or one-time code field as a row of native inputs, one per character, that reads and submits as one value. Typing moves to the next input and Backspace moves back. A pasted or autofilled code, such as one offered by autocomplete="one-time-code", is spread across the inputs, with separators like "-" left out. length sets how many characters, type="alphanumeric" accepts letters as well as digits, and mask hides them. An empty required field is valueMissing and a partly filled one tooShort, and "complete" is dispatched when every input is filled. Style it through its parts and :state(complete), :state(disabled), :state(error), :state(readonly) and :state(required). #24
    • Adds Range Slider, slab-range-slider: a two-thumb slider for picking a range, following the APG multi-thumb slider pattern. Each thumb is a [role=slider] bounded by the other, so they can meet but not pass. start-value and end-value are the range, clamped to min and max and snapped to step, and the form gets both under name. Drag a thumb, press the track to bring the nearer one there, or use the arrow keys, Page Up and Page Down, and Home and End. Style it through its parts and :state(disabled) and :state(dragging). #17
    • Adds Rating, slab-rating: a row of native radios, one for each point from 1 to max (5 by default), in a [role=radiogroup] named by label. value is the checked radio's number, and the form gets it under name. With step="0.5", there are two radios to a star, one for each half, which are ::part(start) and ::part(end). It's form-associated, with required, setCustomValidity(), setValidity() and a validity message, as on Radio Group. Each radio is ::part(star), and those up to the value are ::part(filled) too. While the pointer is over a radio, those up to it are filled instead, and the host is :state(previewing). Style it through its parts and :state(disabled), :state(error), :state(previewing) and :state(required). #23
    • Splitter's separator no longer scrolls the page when it's dragged in Safari on iOS. It cancels "touchstart" while it isn't disabled, since touch-action: none alone doesn't stop the scroll there. #19
    • Adds Splitter, slab-splitter: two panes, in its "primary" and "secondary" slots, with a [role=separator] between them that resizes them, following the APG window splitter pattern. Drag the separator, or move it with the arrow keys by step, Home and End to min and max, and Enter to collapse the primary pane and restore it. value is the primary pane's share as a percentage, and orientation="horizontal" stacks the panes. Style it through its parts and :state(collapsed), :state(disabled) and :state(dragging). #15
    • Adds Time Field, slab-time-field: a time field around a native <input type="time">, with the same API as Date Field. Its value is a 24-hour "hh:mm" string whatever clock the browser shows, and min, max, step and required validate the way they do on the input, including a max earlier than min for a range across midnight. #14
  10. 0.1.2

    • Combobox takes multiple. Each selected Option is shown before the input as a tag, a button that removes it, and choosing an Option toggles it and leaves the listbox open. Backspace in an empty input removes the last tag, and Left at the start of the input moves to the tags. values reads and sets every selected value, in the order they were chosen, and each is submitted as its own entry, as a <select multiple> submits them. Style the tags with ::part(tag) and ::part(tags), and name their buttons with removeLabel. #11
    • Adds Toggle Group, slab-toggle-group, and its slab-toggle-group-button: a row of toggle buttons that Tab reaches once and the arrow keys move between. One button is pressed at a time, or several with multiple. Set pressed on a button that starts out pressed; the group handles aria-pressed. value and values read and set which are pressed. #9
  11. 0.1.1

    • The package now includes its custom elements manifest. Tools that read "customElements" from package.json, such as IDE plugins, Storybook and linters, can find every component's attributes, properties, events, slots, CSS parts and custom properties. It's at slab-elements/custom-elements.json. #5
  12. 0.1.0

    • The first release: 32 headless Web Components, each built on a native element, with keyboard and focus handling, ARIA, form participation and events, and no visual styles. Style them with ::part() and :state(), or subclass them and set styles. See slab-elements.dev to get started.