Repository navigation
Releases
slab-elements@0.3.1
Patch Changes
-
#86
a866d14Thanks @ynotdraw! - Adds Alert Dialog,slab-alert-dialog: a modal Dialog withrole="alertdialog"for a question that needs an answer, such as confirming a delete. It has a built-in Cancel button that focus starts on, adescriptionthat's read with the label, and no light dismiss. Change the Cancel button's text withcancel-label, or withalertDialogCancelinregisterStrings(). -
#88
8c56b61Thanks @ynotdraw! - 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. -
#96
4f8ec31Thanks @ynotdraw! - 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. -
#98
8a8486fThanks @ynotdraw! - Adds Grid List,slab-grid-listandslab-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. Setselection-modeto"single"or"multiple"to select rows with a click, Space or Enter. -
#90
2e78fc6Thanks @ynotdraw! - Hover Card points its anchor'saria-detailsat the card's content, so a screenreader can tell there's more about the anchor, and has alabelattribute that makes the card a group named by it. -
#97
0e7020eThanks @ynotdraw! - Menu has submenus. Put aslab-menuinside another with aslab-menu-itemas 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. -
#87
1016b06Thanks @ynotdraw! - 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. -
#89
80636f5Thanks @ynotdraw! - Adds Sortable List,slab-sortable-listandslab-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. -
#94
d9a5acdThanks @ynotdraw! - Adds Table,slab-table, withslab-table-head,slab-table-body,slab-table-foot,slab-table-row,slab-table-column-headerandslab-table-cell: a table that components can render rows and cells into, laid out like a native<table>with the same roles. AsortableColumn Header is a button that sorts its column, setsaria-sort, dispatches "sort" and tells screenreaders how the column is sorted. Change what they're told withtableSortedinregisterStrings(). -
#85
9239b91Thanks @ynotdraw! - Toggle Button is new: a native<button>witharia-pressed, for one setting that's on or off, such as Bold or Mute. A click, Space or Enter presses it or releases it. -
#99
699f5b2Thanks @ynotdraw! - Listbox and Combobox have avirtualattribute 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 getaria-posinsetandaria-setsize, and the active one stays in the accessibility tree when it's scrolled away from.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.
slab-elements@0.3.0
Minor Changes
- #68
c39c01cThanks @ynotdraw! - 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 newfocus-visiblepart, as in::part(separator focus-visible).
Patch Changes
-
#74
0479423Thanks @ynotdraw! - Withrange, 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 withrangeStartedLabelandrangeSelectedLabel. -
#71
2eb7fb7Thanks @ynotdraw! - The styled Checkbox's box is 24 pixels square rather than 22, the smallest target size WCAG 2.5.8 allows. -
#70
dce96a7Thanks @ynotdraw! - Color Picker'sarea-thumb,hue-thumbandalpha-thumbparts are listed in the elements manifest again, so editors and the docs show them. -
#72
2ab652bThanks @ynotdraw! - Command Palette tells screenreaders how many Options are left once typing pauses, the way Combobox does. SetresultsLabelto change what it says. With none left, what's slotted intoemptyis announced instead, as before, or "No results" when nothing is. -
#75
e1dd766Thanks @ynotdraw! - Disclosure has aheading-levelattribute that makes its label a heading of that level, as the APG's accordion puts each header in one. -
#73
a12cd3dThanks @ynotdraw! - File Drop tells screenreaders what a drop did: how many files were added, how many were left out for not matchingaccept, and when a drop of several files was ignored withoutmultiple. Change what it says withaddedLabel,notAcceptedLabelandtoo-many-label. -
#79
b293babThanks @ynotdraw! - Meter has aformatValueproperty, a function of the value whose result screenreaders read instead of the bare number, such as "3 of 5 GB". -
#76
83653c5Thanks @ynotdraw! - Popover has alabelattribute that makes it a non-modal dialog named by the label, witharia-haspopup="dialog"on its anchor, for a popover that holds a form or controls rather than a few words. -
#80
585778aThanks @ynotdraw! - Progress has aformatValueproperty, a function of the value whose result screenreaders read instead of a percentage, such as "3 of 10 files". -
#78
14d0e01Thanks @ynotdraw! - Range Slider has aformatValueproperty, a function of a thumb's value whose result screenreaders read instead of the bare number, such as "$40". -
#69
5bfb767Thanks @ynotdraw! - Range Slider'sstartandendparts are listed in the elements manifest again, so editors and the docs show them. -
#81
a36f03dThanks @ynotdraw! - Rating has aformatValueproperty, a function of each radio's number that names it, such as "3 stars" rather than "3". -
#77
bc5bc57Thanks @ynotdraw! - Slider has aformatValueproperty, a function of the value whose result screenreaders read instead of the bare number, such as "$40".
slab-elements@0.2.0
Minor Changes
-
#63
95ef80aThanks @ynotdraw! - 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" afterlabel, 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 newfocus-visiblepart, as in::part(hue-thumb focus-visible). -
#62
ac4b5b8Thanks @ynotdraw! - 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 newfocus-visiblepart, as in::part(start focus-visible).
Patch Changes
-
#61
62c9ae5Thanks @ynotdraw! - Combobox now tells screenreaders how many Options are left once typing pauses ("No results", "1 result", "3 results"), and which tag was removed whenmultipleis set. Before, filtering and removing a tag happened silently. Both messages can be replaced, throughresultsLabelandremovedLabel. -
#52
03477ceThanks @ynotdraw! -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, anaria-labeloraria-describedbyyou put on the host went unread, and so did the description Tooltip gives its anchor and thearia-expandedPopover and Menu give theirs when the anchor was one of these. ID references, such asaria-describedby, are resolved where the host is and kept in step as they change. -
#53
e959074Thanks @ynotdraw! - Carousel'sautoplayno 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. -
#45
956ac66Thanks @ynotdraw! - 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'sopen,show(),close(),closedby, label, focus trap and "cancel" and "close". Opening it empties the input and focuses it. Typing filters the Options byfilter, 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'svalueasreturnValue. A Close button beside the input closes it without choosing, which matters on phones whereclosedby="any"isn't supported, and thecloseslot changes what it says. Closing it any way other than choosing leavesreturnValueempty.queryis 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 theemptyslot is shown in a status region. Style it through::part(dialog),::part(label),::part(input),::part(close),::part(listbox)and::part(empty). -
#42
79651cbThanks @ynotdraw! - Adds Copy Button,slab-copy-button: a native<button>that writes text to the clipboard when it's pressed. It copiesvalue, or, withfrom, thevalueor rendered text of the element with thatidat the moment it's pressed, so a code block or an input can be copied without keepingvaluein step. Once copied,copied-label("Copied") is announced from a status beside the button, the host matches:state(copied)forfeedback-duration(2000ms by default), and "copied" is dispatched. When the clipboard refuses, as it does in a page that isn't served securely,failed-labelis announced, the host matches:state(failed), and "copy-error" is dispatched instead. Style it through::part(button),:state(copied)and:state(failed). -
#36
837aa4eThanks @ynotdraw! - 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 israngeUnderflowandrangeOverflow, as a date outsideminandmaxis on a single input.start-valueandend-valueare ISO "yyyy-mm-dd" strings, and the form gets both undername, the start and then the end. The group is named bylabel, and each input by it andstart-labelorend-label, "Start" and "End" unless you set them. Style it through its parts and:state(disabled),:state(error),:state(readonly)and:state(required). -
#41
d257c59Thanks @ynotdraw! - 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 bylabeland 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.valueis the last committed value, and it's what the form gets undername. "change" is dispatched when an edit is committed with a different value.edit(),commit()andcancel()do what the keys do, andeditingsays which is showing. While it's empty, the button showsplaceholder. Style it through::part(preview),::part(input),::part(label)and::part(description), and:state(disabled),:state(editing)and:state(empty). -
#40
5b24c72Thanks @ynotdraw! - 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 givenaria-posinsetandaria-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 setbusywhile you do.totalis 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 bylabel. Style it through::part(feed). -
#54
b03c6abThanks @ynotdraw! - Field now describes its control by what's slotted intodescription, through the control'saria-describedby, after any IDs it already has, and sets the control'saria-invalidwhileerroris set. Before, a screenreader read neither the hint nor the error, nor that the control was invalid. -
#51
57f1c76Thanks @ynotdraw! - 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. -
#56
e61e570Thanks @ynotdraw! - Checkbox Group and Radio Group now tell screenreaders when they're invalid. Radio Group setsaria-invalidon its radiogroup. A group role can't takearia-invalid, so Checkbox Group sets it on each of its Checkboxes instead. Both follow the Gr...
slab-elements@0.1.3
Patch Changes
-
#18
50c1b2bThanks @ynotdraw! - Addsrangeto 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.valueis 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 isaria-multiselectable. -
#25
3b2a7a6Thanks @ynotdraw! - 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 whenautoplayis set are real buttons, rather than the::scroll-button()and::scroll-markerpseudo-elements only Chromium has, so they're named and styled the same everywhere.indexis the current slide's,loopwraps Previous and Next, andautoplaymoves on everyintervalmilliseconds, pausing while the carousel is hovered or focused. Slides out of view areinert. Style it through its parts and:state(first),:state(last)and:state(rotating). -
#27
343b01eThanks @ynotdraw! - Adds Color Picker,slab-color-picker: a saturation and brightness area, a hue slider, an alpha slider withalpha, a hex field, and swatches fromswatches. 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.valueis a lowercase "#rrggbb", or "#rrggbbaa" withalpha, and the form gets it undername. Style it through its parts,:state(disabled)and:state(dragging), and the--color-picker-hue,--color-picker-opaqueand--color-picker-valuecustom properties it sets. -
#26
a89eecdThanks @ynotdraw! - Adds Context Menu,slab-context-menu: Menu's Menu Items in a[role=menu]popover that opens over whatever is slotted intotarget, 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). -
#22
6e62e79Thanks @ynotdraw! - 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 rovingtabindex, 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). -
#24
84dab08Thanks @ynotdraw! - 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 byautocomplete="one-time-code", is spread across the inputs, with separators like "-" left out.lengthsets how many characters,type="alphanumeric"accepts letters as well as digits, andmaskhides them. An empty required field isvalueMissingand a partly filled onetooShort, 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). -
#17
8e62a14Thanks @ynotdraw! - 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-valueandend-valueare the range, clamped tominandmaxand snapped tostep, and the form gets both undername. 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). -
#23
f02861aThanks @ynotdraw! - Adds Rating,slab-rating: a row of native radios, one for each point from 1 tomax(5 by default), in a[role=radiogroup]named bylabel.valueis the checked radio's number, and the form gets it undername. Withstep="0.5", there are two radios to a star, one for each half, which are::part(start)and::part(end). It's form-associated, withrequired,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 arefilledinstead, and the host is:state(previewing). Style it through its parts and:state(disabled),:state(error),:state(previewing)and:state(required). -
#19
137b3f7Thanks @ynotdraw! - Splitter's separator no longer scrolls the page when it's dragged in Safari on iOS. It cancels "touchstart" while it isn't disabled, sincetouch-action: nonealone doesn't stop the scroll there. -
#15
0e4f9e6Thanks @ynotdraw! - 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 bystep, Home and End tominandmax, and Enter to collapse the primary pane and restore it.valueis the primary pane's share as a percentage, andorientation="horizontal"stacks the panes. Style it through its parts and:state(collapsed),:state(disabled)and:state(dragging). -
#14
d434e2cThanks @ynotdraw! - 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, andmin,max,stepandrequiredvalidate the way they do on the input, including amaxearlier thanminfor a range across midnight.
slab-elements@0.1.2
Patch Changes
-
#11
e5b3ee2Thanks @ynotdraw! - Combobox takesmultiple. 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.valuesreads 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 withremoveLabel. -
#9
7c4e2c7Thanks @ynotdraw! - Adds Toggle Group,slab-toggle-group, and itsslab-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 withmultiple. Setpressedon a button that starts out pressed; the group handlesaria-pressed.valueandvaluesread and set which are pressed.
slab-elements@0.1.1
Patch Changes
- #5
719cb17Thanks @ynotdraw! - The package now includes its custom elements manifest. Tools that read"customElements"frompackage.json, such as IDE plugins, Storybook and linters, can find every component's attributes, properties, events, slots, CSS parts and custom properties. It's atslab-elements/custom-elements.json.