Skip to content

Commit

Permalink
FEAT/adding types for the role attribute instead of string
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustinSorel committed Jun 18, 2024
1 parent d3b8797 commit 087ae2c
Showing 1 changed file with 74 additions and 1 deletion.
75 changes: 74 additions & 1 deletion packages/html/jsx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ declare namespace JSX {
hidden?: undefined | string | boolean;
id?: undefined | number | string;
popover?: undefined | boolean | 'auto' | 'manual';
role?: undefined | string;
role?: undefined | AriaRole;
lang?: undefined | string;
draggable?: undefined | string | boolean;
spellcheck?: undefined | string | boolean;
Expand Down Expand Up @@ -852,3 +852,76 @@ declare namespace JSX {
wbr: HtmlTag;
}
}

// All the WAI-ARIA 1.1 role attribute values from https://www.w3.org/TR/wai-aria-1.1/#role_definitions
type AriaRole =
| "alert"
| "alertdialog"
| "application"
| "article"
| "banner"
| "button"
| "cell"
| "checkbox"
| "columnheader"
| "combobox"
| "complementary"
| "contentinfo"
| "definition"
| "dialog"
| "directory"
| "document"
| "feed"
| "figure"
| "form"
| "grid"
| "gridcell"
| "group"
| "heading"
| "img"
| "link"
| "list"
| "listbox"
| "listitem"
| "log"
| "main"
| "marquee"
| "math"
| "menu"
| "menubar"
| "menuitem"
| "menuitemcheckbox"
| "menuitemradio"
| "navigation"
| "none"
| "note"
| "option"
| "presentation"
| "progressbar"
| "radio"
| "radiogroup"
| "region"
| "row"
| "rowgroup"
| "rowheader"
| "scrollbar"
| "search"
| "searchbox"
| "separator"
| "slider"
| "spinbutton"
| "status"
| "switch"
| "tab"
| "table"
| "tablist"
| "tabpanel"
| "term"
| "textbox"
| "timer"
| "toolbar"
| "tooltip"
| "tree"
| "treegrid"
| "treeitem"
| (string & {});

0 comments on commit 087ae2c

Please sign in to comment.